master xplshn/aruu / shared / md5.h
 1/* public domain md5 implementation based on rfc1321 and libtomcrypt */
 2
 3struct md5 {
 4	uint64_t len;    /* processed message length */
 5	uint32_t h[4];   /* hash state */
 6	uint8_t buf[64]; /* message block buffer */
 7};
 8
 9enum { MD5_DIGEST_LENGTH = 16 };
10
11/* reset state */
12void md5_init(void *ctx);
13/* process message */
14void md5_update(void *ctx, const void *m, unsigned long len);
15/* get message digest */
16/* state is ruined after sum, keep a copy if multiple sum is needed */
17/* part of the message might be left in s, zero it if secrecy is needed */
18void md5_sum(void *ctx, uint8_t md[MD5_DIGEST_LENGTH]);