1 /* $Id: md5.h 4567 2001-02-24 08:10:16Z rra $
3 ** RSA Data Security, Inc. MD5 Message-Digest Algorithm
5 ** LANDON CURT NOLL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
6 ** INCLUDING ALL IMPLIED WARRANTIES OF MER- CHANTABILITY AND FITNESS. IN
7 ** NO EVENT SHALL LANDON CURT NOLL BE LIABLE FOR ANY SPECIAL, INDIRECT OR
8 ** CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF
9 ** USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
10 ** OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
11 ** PERFORMANCE OF THIS SOFTWARE.
13 ** Copyright (C) 1990, RSA Data Security, Inc. All rights reserved.
15 ** License to copy and use this software is granted provided that it is
16 ** identified as the "RSA Data Security, Inc. MD5 Message-Digest
17 ** Algorithm" in all material mentioning or referencing this software or
20 ** License is also granted to make and use derivative works provided that
21 ** such works are identified as "derived from the RSA Data Security,
22 ** Inc. MD5 Message-Digest Algorithm" in all material mentioning or
23 ** referencing the derived work.
25 ** RSA Data Security, Inc. makes no representations concerning either the
26 ** merchantability of this software or the suitability of this software for
27 ** any particular purpose. It is provided "as is" without express or
28 ** implied warranty of any kind.
30 ** These notices must be retained in any copies of any part of this
31 ** documentation and/or software.
37 #include <inn/defines.h>
39 /* Make sure we have uint32_t. */
40 #include <sys/types.h>
41 #if INN_HAVE_INTTYPES_H
42 # include <inttypes.h>
45 /* SCO OpenServer gets int32_t from here. */
46 #if INN_HAVE_SYS_BITYPES_H
47 # include <sys/bitypes.h>
50 /* Bytes to process at once, defined by the algorithm. */
51 #define MD5_CHUNKSIZE (1 << 6)
52 #define MD5_CHUNKWORDS (MD5_CHUNKSIZE / sizeof(uint32_t))
54 /* Length of the digest, defined by the algorithm. */
55 #define MD5_DIGESTSIZE 16
56 #define MD5_DIGESTWORDS (MD5_DIGESTSIZE / sizeof(uint32_t))
60 /* Data structure for MD5 message-digest computation. */
62 uint32_t count[2]; /* A 64-bit byte count. */
63 uint32_t buf[MD5_DIGESTWORDS]; /* Scratch buffer. */
65 unsigned char byte[MD5_CHUNKSIZE]; /* Byte chunk buffer. */
66 uint32_t word[MD5_CHUNKWORDS]; /* Word chunk buffer. */
68 unsigned int datalen; /* Length of data in in. */
69 unsigned char digest[MD5_DIGESTSIZE]; /* Final digest. */
72 extern void md5_hash(const unsigned char *, size_t, unsigned char *);
73 extern void md5_init(struct md5_context *);
74 extern void md5_update(struct md5_context *, const unsigned char *, size_t);
75 extern void md5_final(struct md5_context *);
79 #endif /* !INN_MD5_H */