]>
Commit | Line | Data |
---|---|---|
1 | #ifndef _MD5_H | |
2 | #define _MD5_H | |
3 | ||
4 | #ifndef uint8 | |
5 | #define uint8 unsigned char | |
6 | #endif | |
7 | ||
8 | #ifndef uint32 | |
9 | #define uint32 unsigned long int | |
10 | #endif | |
11 | ||
12 | typedef struct | |
13 | { | |
14 | uint32 total[2]; | |
15 | uint32 state[4]; | |
16 | uint8 buffer[64]; | |
17 | } | |
18 | md5_context; | |
19 | ||
20 | void md5_starts( md5_context *ctx ); | |
21 | void md5_update( md5_context *ctx, uint8 *input, uint32 length ); | |
22 | void md5_finish( md5_context *ctx, uint8 digest[16] ); | |
23 | ||
24 | #endif /* md5.h */ | |
25 | ||
26 | ||
27 | /* --------------------------------------- | |
28 | * OLD CRAP HERE | |
29 | * DELETE THIS SOME DAY | |
30 | * | |
31 | *----------------------------------------*/ | |
32 | ||
33 | /* GLOBAL.H - RSAREF types and constants */ | |
34 | ||
35 | /* PROTOTYPES should be set to one if and only if the compiler supports | |
36 | function argument prototyping. | |
37 | The following makes PROTOTYPES default to 0 if it has not already | |
38 | been defined with C compiler flags. | |
39 | */ | |
40 | #ifndef PROTOTYPES | |
41 | #define PROTOTYPES 1 | |
42 | #endif | |
43 | ||
44 | /* POINTER defines a generic pointer type */ | |
45 | typedef unsigned char *POINTER; | |
46 | ||
47 | /* UINT2 defines a two byte word */ | |
48 | typedef unsigned short int UINT2; | |
49 | ||
50 | /* UINT4 defines a four byte word */ | |
51 | #if defined(__alpha) || defined(_LP64) || defined(__LP64__) | |
52 | typedef unsigned int UINT4; | |
53 | #else | |
54 | typedef unsigned long int UINT4; | |
55 | #endif | |
56 | ||
57 | /* PROTO_LIST is defined depending on how PROTOTYPES is defined above. | |
58 | If using PROTOTYPES, then PROTO_LIST returns the list, otherwise it | |
59 | returns an empty list. | |
60 | */ | |
61 | #if PROTOTYPES | |
62 | #define PROTO_LIST(list) list | |
63 | #else | |
64 | #define PROTO_LIST(list) () | |
65 | #endif | |
66 | ||
67 | /* MD5.H - header file for MD5C.C */ | |
68 | ||
69 | /* Copyright (C) 1991-2, RSA Data Security, Inc. Created 1991. All | |
70 | rights reserved. | |
71 | ||
72 | License to copy and use this software is granted provided that it | |
73 | is identified as the "RSA Data Security, Inc. MD5 Message-Digest | |
74 | Algorithm" in all material mentioning or referencing this software | |
75 | or this function. | |
76 | ||
77 | License is also granted to make and use derivative works provided | |
78 | that such works are identified as "derived from the RSA Data | |
79 | Security, Inc. MD5 Message-Digest Algorithm" in all material | |
80 | mentioning or referencing the derived work. | |
81 | ||
82 | RSA Data Security, Inc. makes no representations concerning either | |
83 | the merchantability of this software or the suitability of this | |
84 | software for any particular purpose. It is provided "as is" | |
85 | without express or implied warranty of any kind. | |
86 | ||
87 | These notices must be retained in any copies of any part of this | |
88 | documentation and/or software. | |
89 | */ | |
90 | ||
91 | /* MD5 context. */ | |
92 | typedef struct { | |
93 | UINT4 state[4]; /* state (ABCD) */ | |
94 | UINT4 count[2]; /* number of bits, modulo 2^64 (lsb first) */ | |
95 | unsigned char buffer[64]; /* input buffer */ | |
96 | } MD5_CTX; | |
97 | ||
98 | void MD5Init PROTO_LIST ((MD5_CTX *)); | |
99 | void MD5Update PROTO_LIST ((MD5_CTX *, unsigned char *, unsigned int)); | |
100 | void MD5Final PROTO_LIST ((unsigned char [16], MD5_CTX *)); | |
101 |