| Guido van Rossum | 13ecc7a | 1993-11-01 16:19:05 +0000 | [diff] [blame] | 1 | /* MD5.H - header file for MD5C.C | 
 | 2 |  */ | 
 | 3 |  | 
 | 4 | /* Copyright (C) 1991-2, RSA Data Security, Inc. Created 1991. All | 
 | 5 | rights reserved. | 
 | 6 |  | 
 | 7 | License to copy and use this software is granted provided that it | 
 | 8 | is identified as the "RSA Data Security, Inc. MD5 Message-Digest | 
 | 9 | Algorithm" in all material mentioning or referencing this software | 
 | 10 | or this function. | 
 | 11 |  | 
 | 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 | /* ========== include global.h ========== */ | 
 | 27 | /* GLOBAL.H - RSAREF types and constants | 
 | 28 |  */ | 
 | 29 |  | 
| Guido van Rossum | 13ecc7a | 1993-11-01 16:19:05 +0000 | [diff] [blame] | 30 | /* POINTER defines a generic pointer type */ | 
 | 31 | typedef unsigned char *POINTER; | 
 | 32 |  | 
 | 33 | /* UINT2 defines a two byte word */ | 
 | 34 | typedef unsigned short int UINT2; | 
 | 35 |  | 
| Guido van Rossum | b123691 | 1996-01-12 01:38:49 +0000 | [diff] [blame] | 36 | #ifdef HAVE_LIMITS_H | 
 | 37 | #include <limits.h> | 
 | 38 | #else | 
| Guido van Rossum | be6da27 | 1996-07-21 02:34:55 +0000 | [diff] [blame] | 39 | /* Wild guess */ | 
 | 40 | #define LONG_MAX 2147483647L | 
| Guido van Rossum | b123691 | 1996-01-12 01:38:49 +0000 | [diff] [blame] | 41 | #endif | 
 | 42 |  | 
| Guido van Rossum | 13ecc7a | 1993-11-01 16:19:05 +0000 | [diff] [blame] | 43 | /* UINT4 defines a four byte word */ | 
| Guido van Rossum | be6da27 | 1996-07-21 02:34:55 +0000 | [diff] [blame] | 44 | #if defined(INT_MAX) && INT_MAX == 2147483647 | 
| Guido van Rossum | b123691 | 1996-01-12 01:38:49 +0000 | [diff] [blame] | 45 | typedef unsigned int UINT4; | 
 | 46 | #else | 
| Guido van Rossum | be6da27 | 1996-07-21 02:34:55 +0000 | [diff] [blame] | 47 | #if defined(LONG_MAX) && LONG_MAX == 2147483647L | 
| Guido van Rossum | 13ecc7a | 1993-11-01 16:19:05 +0000 | [diff] [blame] | 48 | typedef unsigned long int UINT4; | 
| Guido van Rossum | b123691 | 1996-01-12 01:38:49 +0000 | [diff] [blame] | 49 | #endif | 
 | 50 | /* Too bad if neither is */ | 
 | 51 | #endif | 
| Guido van Rossum | 13ecc7a | 1993-11-01 16:19:05 +0000 | [diff] [blame] | 52 |  | 
| Guido van Rossum | 13ecc7a | 1993-11-01 16:19:05 +0000 | [diff] [blame] | 53 | /* ========== End global.h; continue md5.h ========== */ | 
 | 54 |  | 
 | 55 | /* MD5 context. */ | 
 | 56 | typedef struct { | 
| Fred Drake | 859bad0 | 2000-07-10 04:20:57 +0000 | [diff] [blame] | 57 |     UINT4 state[4];                                   /* state (ABCD) */ | 
 | 58 |     UINT4 count[2];        /* number of bits, modulo 2^64 (lsb first) */ | 
 | 59 |     unsigned char buffer[64];                         /* input buffer */ | 
| Guido van Rossum | 13ecc7a | 1993-11-01 16:19:05 +0000 | [diff] [blame] | 60 | } MD5_CTX; | 
 | 61 |  | 
| Guido van Rossum | 53d0de4 | 1996-05-24 20:51:38 +0000 | [diff] [blame] | 62 | /* Rename all exported symbols to avoid conflicts with similarly named | 
 | 63 |    symbols in some systems' standard C libraries... */ | 
 | 64 |  | 
 | 65 | #define MD5Init _Py_MD5Init | 
 | 66 | #define MD5Update _Py_MD5Update | 
 | 67 | #define MD5Final _Py_MD5Final | 
 | 68 |  | 
| Fred Drake | 859bad0 | 2000-07-10 04:20:57 +0000 | [diff] [blame] | 69 | void MD5Init(MD5_CTX *); | 
 | 70 | void MD5Update(MD5_CTX *, unsigned char *, unsigned int); | 
 | 71 | void MD5Final(unsigned char [16], MD5_CTX *); |