Last change
on this file since 46b5ed1 was
34afea7,
checked in by dequis <dx@…>, at 2015-01-31T23:58:57Z
|
Use glib's GChecksum for md5/sha1
This changes behavior slightly:
- md5_init()/sha1_init() allocate a GChecksum
- md5_finish()/sha1_finish() close and free() it
- md5_digest_keep() was added (no sha1 equivalent needed)
And yes, glib has this concept of "closing" the GChecksum, which means
it can't be used anymore after g_checksum_get_digest().
jabber_cache_add() actually seems to need to do that to generate some
random-ish values, so i kept that working by adding a md5_digest_keep()
function that copies the GChecksum before it gets closed
GChecksum was introduced in glib 2.16, so the configure script version
was bumped. We were already depending on glib 2.16 accidentally
(some post-3.2.2 code uses GHashTableIter)
|
-
Property mode set to
100644
|
File size:
417 bytes
|
Line | |
---|
1 | #ifndef _MD5_H |
---|
2 | #define _MD5_H |
---|
3 | |
---|
4 | #include <glib.h> |
---|
5 | #include <gmodule.h> |
---|
6 | |
---|
7 | typedef guint8 md5_byte_t; |
---|
8 | typedef GChecksum *md5_state_t; |
---|
9 | |
---|
10 | |
---|
11 | #define MD5_HASH_SIZE 16 |
---|
12 | |
---|
13 | void md5_init(md5_state_t *); |
---|
14 | void md5_append(md5_state_t *, const guint8 *, unsigned int); |
---|
15 | void md5_finish(md5_state_t *, guint8 digest[MD5_HASH_SIZE]); |
---|
16 | void md5_digest_keep(md5_state_t *, guint8 digest[MD5_HASH_SIZE]); |
---|
17 | void md5_free(md5_state_t *); |
---|
18 | |
---|
19 | #endif |
---|
Note: See
TracBrowser
for help on using the repository browser.