annotate src/md5-util.h @ 999:bbed8e9a5d33

Indentation fixes.
author zas_
date Tue, 26 Aug 2008 21:19:33 +0000
parents ddabc4873a3f
children 1646720364cf
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 */
64
04ff0df3ad2f Mon Aug 15 17:13:57 2005 John Ellis <johne@verizon.net>
gqview
parents: 9
diff changeset
45 void md5_get_digest (const guchar *buffer, gint buffer_size, guchar digest[16]);
9
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 */