md5.h revision d7ed851d6fc26c5e7db96971dbe6b44342b97727
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 MD5Init, call MD5Update as 14 * needed on buffers full of bytes, and then call MD5Final, which 15 * will fill a supplied 16-byte array with the digest. 16 */ 17 18#ifndef MD5_H_ 19#define MD5_H_ 20 21#define MD5_DIGEST_LENGTH 16 22#define MD5_BLOCK_LENGTH 64 23 24typedef struct MD5Context { 25 uint32_t state[4]; /* state (ABCD) */ 26 uint64_t count; /* number of bits, modulo 2^64 (lsb first) */ 27 unsigned char buffer[MD5_BLOCK_LENGTH]; /* input buffer */ 28} MD5_CTX; 29 30void MD5Init(MD5_CTX *); 31void MD5Update(MD5_CTX *, const unsigned char *, size_t); 32void MD5Final(unsigned char[MD5_DIGEST_LENGTH], MD5_CTX *); 33#endif 34