annotate src/md5-util.h @ 42:606fcf461a68

Sat May 14 13:04:23 2005 John Ellis <johne@verizon.net> * po/cs.po: Update Czech translation, submitted by Jan Raska <jan.raska@tiscali.cz> * de.po, fr.po: Typo and spelling fixes. Sat May 14 12:23:19 2005 John Ellis <johne@verizon.net> * image.c, pixbuf-renderer.c: Fix sending of complete signal. * ui_pathsel.c: Guard against strcmp of NULL dd->path, fixes crash. * utilops.c: Additional validation for destination of copy/move dialogs, and do not include extension when conveniently selecting filename text in rename dialogs. ##### Note: GQview CVS on sourceforge is not always up to date, please use ##### ##### an offical release when making enhancements and translation updates. #####
author gqview
date Sat, 14 May 2005 20:58:18 +0000
parents d907d608745f
children 04ff0df3ad2f
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1 /*
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2 * This code implements the MD5 message-digest algorithm.
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
3 * The algorithm is due to Ron Rivest. This code was
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
4 * written by Colin Plumb in 1993, no copyright is claimed.
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
5 * This code is in the public domain; do with it what you wish.
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
6 *
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
7 * Equivalent code is available from RSA Data Security, Inc.
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
8 * This code has been tested against that, and is equivalent,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
9 * except that you don't need to include two pages of legalese
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
10 * with every copy.
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
11 *
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
12 * To compute the message digest of a chunk of bytes, declare an
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
13 * MD5Context structure, pass it to rpmMD5Init, call rpmMD5Update as
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
14 * needed on buffers full of bytes, and then call rpmMD5Final, which
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
15 * will fill a supplied 16-byte array with the digest.
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
16 */
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
17
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
18 /* parts of this file are :
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
19 * Written March 1993 by Branko Lankester
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
20 * Modified June 1993 by Colin Plumb for altered md5.c.
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
21 * Modified October 1995 by Erik Troan for RPM
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
22 */
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
23
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
24
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
25 #ifndef MD5_UTIL_H
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
26 #define MD5_UTIL_H
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
27
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
28 #include <glib.h>
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
29
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
30
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
31 typedef struct _MD5Context {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
32 guint32 buf[4];
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
33 guint32 bits[2];
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
34 guchar in[64];
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
35 gint doByteReverse;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
36 } MD5Context;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
37
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
38
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
39 /* raw routines */
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
40 void md5_init (MD5Context *ctx);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
41 void md5_update (MD5Context *ctx, const guchar *buf, guint32 len);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
42 void md5_final (MD5Context *ctx, guchar digest[16]);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
43
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
44 /* generate digest from memory buffer */
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
45 void md5_get_digest (const gchar *buffer, gint buffer_size, guchar digest[16]);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
46
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
47 /* generate digest from file */
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
48 gboolean md5_get_digest_from_file(const gchar *path, guchar digest[16]);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
49 gboolean md5_get_digest_from_file_utf8(const gchar *path, guchar digest[16]);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
50
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
51 /* generate md5 string from file,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
52 * on failure returns newly allocated copy of error_text, error_text may be NULL
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
53 */
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
54 gchar *md5_text_from_file_utf8(const gchar *path, const gchar *error_text);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
55
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
56 /* convert digest to/from a NULL terminated text string, in ascii encoding */
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
57 gchar *md5_digest_to_text(guchar digest[16]);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
58 gboolean md5_digest_from_text(const gchar *text, guchar digest[16]);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
59
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
60
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
61 #endif /* MD5_UTILS_H */
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
62