1 /* @(#)md4.h 1.4 10/08/27 2009-2010 J. Schilling */ 2 /* 3 * MD4 hash code taken from OpenBSD 4 * 5 * Portions Copyright (c) 2009-2010 J. Schilling 6 */ 7 /* $OpenBSD: md4.h,v 1.15 2004/06/22 01:57:30 jfb Exp $ */ 8 9 /* 10 * This code implements the MD4 message-digest algorithm. 11 * The algorithm is due to Ron Rivest. This code was 12 * written by Colin Plumb in 1993, no copyright is claimed. 13 * This code is in the public domain; do with it what you wish. 14 * Todd C. Miller modified the MD5 code to do MD4 based on RFC 1186. 15 * 16 * Equivalent code is available from RSA Data Security, Inc. 17 * This code has been tested against that, and is equivalent, 18 * except that you don't need to include two pages of legalese 19 * with every copy. 20 */ 21 22 #ifndef _SCHILY_MD4_H 23 #define _SCHILY_MD4_H 24 25 #ifndef _SCHILY_MCONFIG_H 26 #include <schily/mconfig.h> 27 #endif 28 #include <schily/utypes.h> 29 30 #define MD4_BLOCK_LENGTH 64 31 #define MD4_DIGEST_LENGTH 16 32 #define MD4_DIGEST_STRING_LENGTH (MD4_DIGEST_LENGTH * 2 + 1) 33 34 typedef struct MD4Context { 35 UInt32_t state[4]; /* state */ 36 UInt32_t count[2]; /* number of bits, mod 2^64 */ 37 UInt8_t buffer[MD4_BLOCK_LENGTH]; /* input buffer */ 38 } MD4_CTX; 39 40 #ifdef __cplusplus 41 extern "C" { 42 #endif 43 44 extern void MD4Init __PR((MD4_CTX *)); 45 extern void MD4Update __PR((MD4_CTX *, const void *, size_t)); 46 extern void MD4Pad __PR((MD4_CTX *)); 47 extern void MD4Final __PR((UInt8_t [MD4_DIGEST_LENGTH], MD4_CTX *)); 48 extern void MD4Transform __PR((UInt32_t [4], 49 const UInt8_t [MD4_BLOCK_LENGTH])); 50 extern char *MD4End __PR((MD4_CTX *, char *)); 51 extern char *MD4File __PR((const char *, char *)); 52 extern char *MD4FileChunk __PR((const char *, char *, off_t, off_t)); 53 extern char *MD4Data __PR((const UInt8_t *, size_t, char *)); 54 55 #ifdef __cplusplus 56 } 57 #endif 58 59 #endif /* _SCHILY_MD4_H */ 60