Mercurial > dovecot > original-hg > dovecot-1.2
comparison src/lib/md5.h @ 21:163675942b83 HEAD
Replaced the MD5 implementation with Solar Designer's.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Fri, 23 Aug 2002 19:21:36 +0300 |
parents | 3b1985cbc908 |
children | 4a7ab9e94f25 |
comparison
equal
deleted
inserted
replaced
20:df8438cd8a43 | 21:163675942b83 |
---|---|
1 /* | 1 /* |
2 * This code implements the MD5 message-digest algorithm. | 2 * This is an OpenSSL-compatible implementation of the RSA Data Security, |
3 * The algorithm is due to Ron Rivest. This code was | 3 * Inc. MD5 Message-Digest Algorithm. |
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 * | 4 * |
7 * Equivalent code is available from RSA Data Security, Inc. | 5 * Written by Solar Designer <solar@openwall.com> in 2001, and placed in |
8 * This code has been tested against that, and is equivalent, | 6 * the public domain. See md5.c for more information. |
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 */ | 7 */ |
17 | 8 |
18 /* parts of this file are : | 9 #ifndef __MD5_H |
19 * Written March 1993 by Branko Lankester | 10 #define __MD5_H |
20 * Modified June 1993 by Colin Plumb for altered md5.c. | |
21 * Modified October 1995 by Erik Troan for RPM | |
22 */ | |
23 | 11 |
24 | 12 /* Any 32-bit or wider integer data type will do */ |
25 #ifndef MD5_H | 13 typedef unsigned long MD5_u32plus; |
26 #define MD5_H | |
27 | 14 |
28 typedef struct { | 15 typedef struct { |
29 unsigned int buf[4]; | 16 MD5_u32plus lo, hi; |
30 unsigned int bits[2]; | 17 MD5_u32plus a, b, c, d; |
31 unsigned char in[64]; | 18 unsigned char buffer[64]; |
32 int doByteReverse; | 19 MD5_u32plus block[16]; |
33 } MD5Context; | 20 } MD5Context; |
34 | 21 |
22 void md5_init(MD5Context *ctx); | |
23 void md5_update(MD5Context *ctx, const void *data, unsigned int size); | |
24 void md5_final(MD5Context *ctx, unsigned char result[16]); | |
35 | 25 |
36 void md5_get_digest (const char *buffer, unsigned int buffer_size, | 26 void md5_get_digest(const void *data, unsigned int size, |
37 unsigned char digest[16]); | 27 unsigned char result[16]); |
38 | |
39 /* raw routines */ | |
40 void md5_init (MD5Context *ctx); | |
41 void md5_update (MD5Context *ctx, const void *buf, unsigned int len); | |
42 void md5_final (MD5Context *ctx, unsigned char digest[16]); | |
43 | |
44 | 28 |
45 #endif | 29 #endif |