comparison src/md5/md5.h @ 162:52c82d755215

replaced the MD5 implementation with the one of Solar Designer Until now, the sample code of RFC 1321 was used. It had an ugly license. Now we use the implementation of Solar Designer, which is in the Public Domain. http://openwall.info/wiki/people/solar/software/public-domain-source-code/md5
author meillo@marmaro.de
date Sun, 18 Jul 2010 22:01:04 +0200
parents 26e34ae9a3e3
children 06525982a56c
comparison
equal deleted inserted replaced
161:6655f7708ee1 162:52c82d755215
1 /* MD5.H - header file for MD5C.C 1 /*
2 * This is an OpenSSL-compatible implementation of the RSA Data Security,
3 * Inc. MD5 Message-Digest Algorithm (RFC 1321).
4 *
5 * Written by Solar Designer <solar at openwall.com> in 2001, and placed
6 * in the public domain. There's absolutely no warranty.
7 *
8 * See md5.c for more information.
2 */ 9 */
3 10
4 /* Copyright (C) 1991-2, RSA Data Security, Inc. Created 1991. All 11 #ifdef HAVE_OPENSSL
5 rights reserved. 12 #include <openssl/md5.h>
13 #elif !defined(_MD5_H)
14 #define _MD5_H
6 15
7 License to copy and use this software is granted provided that it 16 /* Any 32-bit or wider unsigned integer data type will do */
8 is identified as the "RSA Data Security, Inc. MD5 Message-Digest 17 typedef unsigned int MD5_u32plus;
9 Algorithm" in all material mentioning or referencing this software
10 or this function.
11 18
12 License is also granted to make and use derivative works provided
13 that such works are identified as "derived from the RSA Data
14 Security, Inc. MD5 Message-Digest Algorithm" in all material
15 mentioning or referencing the derived work.
16
17 RSA Data Security, Inc. makes no representations concerning either
18 the merchantability of this software or the suitability of this
19 software for any particular purpose. It is provided "as is"
20 without express or implied warranty of any kind.
21
22 These notices must be retained in any copies of any part of this
23 documentation and/or software.
24 */
25
26 /* MD5 context. */
27 typedef struct { 19 typedef struct {
28 UINT4 state[4]; /* state (ABCD) */ 20 MD5_u32plus lo, hi;
29 UINT4 count[2]; /* number of bits, modulo 2^64 (lsb first) */ 21 MD5_u32plus a, b, c, d;
30 unsigned char buffer[64]; /* input buffer */ 22 unsigned char buffer[64];
23 MD5_u32plus block[16];
31 } MD5_CTX; 24 } MD5_CTX;
32 25
33 void MD5Init PROTO_LIST((MD5_CTX *)); 26 extern void MD5_Init(MD5_CTX *ctx);
34 void MD5Update PROTO_LIST((MD5_CTX *, unsigned char *, unsigned int)); 27 extern void MD5_Update(MD5_CTX *ctx, void *data, unsigned long size);
35 void MD5Final PROTO_LIST((unsigned char[16], MD5_CTX *)); 28 extern void MD5_Final(unsigned char *result, MD5_CTX *ctx);
29
30 #endif