Mercurial > geeqie.yaz
annotate src/md5-util.h @ 859:63e1161ada52
Use flags for pr_zoom_*() functions.
author | zas_ |
---|---|
date | Thu, 26 Jun 2008 15:59:20 +0000 |
parents | ddabc4873a3f |
children | 1646720364cf |
rev | line source |
---|---|
9 | 1 /* |
2 * This code implements the MD5 message-digest algorithm. | |
3 * The algorithm is due to Ron Rivest. This code was | |
4 * written by Colin Plumb in 1993, no copyright is claimed. | |
5 * This code is in the public domain; do with it what you wish. | |
6 * | |
7 * Equivalent code is available from RSA Data Security, Inc. | |
8 * This code has been tested against that, and is equivalent, | |
9 * except that you don't need to include two pages of legalese | |
10 * with every copy. | |
11 * | |
12 * To compute the message digest of a chunk of bytes, declare an | |
13 * MD5Context structure, pass it to rpmMD5Init, call rpmMD5Update as | |
14 * needed on buffers full of bytes, and then call rpmMD5Final, which | |
15 * will fill a supplied 16-byte array with the digest. | |
16 */ | |
17 | |
18 /* parts of this file are : | |
19 * Written March 1993 by Branko Lankester | |
20 * Modified June 1993 by Colin Plumb for altered md5.c. | |
21 * Modified October 1995 by Erik Troan for RPM | |
22 */ | |
23 | |
24 | |
25 #ifndef MD5_UTIL_H | |
26 #define MD5_UTIL_H | |
27 | |
28 #include <glib.h> | |
29 | |
30 | |
31 typedef struct _MD5Context { | |
32 guint32 buf[4]; | |
33 guint32 bits[2]; | |
34 guchar in[64]; | |
35 gint doByteReverse; | |
36 } MD5Context; | |
37 | |
38 | |
39 /* raw routines */ | |
40 void md5_init (MD5Context *ctx); | |
41 void md5_update (MD5Context *ctx, const guchar *buf, guint32 len); | |
42 void md5_final (MD5Context *ctx, guchar digest[16]); | |
43 | |
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 | 46 |
47 /* generate digest from file */ | |
48 gboolean md5_get_digest_from_file(const gchar *path, guchar digest[16]); | |
49 gboolean md5_get_digest_from_file_utf8(const gchar *path, guchar digest[16]); | |
50 | |
51 /* generate md5 string from file, | |
52 * on failure returns newly allocated copy of error_text, error_text may be NULL | |
53 */ | |
54 gchar *md5_text_from_file_utf8(const gchar *path, const gchar *error_text); | |
55 | |
56 /* convert digest to/from a NULL terminated text string, in ascii encoding */ | |
57 gchar *md5_digest_to_text(guchar digest[16]); | |
58 gboolean md5_digest_from_text(const gchar *text, guchar digest[16]); | |
59 | |
60 | |
61 #endif /* MD5_UTILS_H */ |