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