1 |
/** |
2 |
* md5.h: Message Digest 5 structures |
3 |
* |
4 |
* Copyright © 2007 Pippijn van Steenhoven / The Ermyth Team |
5 |
* Rights to this code are as documented in COPYING. |
6 |
* |
7 |
* $Id: md5.h,v 1.4 2007-09-16 18:54:42 pippijn Exp $ |
8 |
*/ |
9 |
|
10 |
#ifndef MD5_H |
11 |
#define MD5_H |
12 |
|
13 |
/* The following tests optimise behaviour on little-endian |
14 |
machines, where there is no need to reverse the byte order |
15 |
of 32 bit words in the MD5 computation. By default, |
16 |
HIGHFIRST is defined, which indicates we're running on a |
17 |
big-endian (most significant byte first) machine, on which |
18 |
the byteReverse function in md5.c must be invoked. However, |
19 |
byteReverse is coded in such a way that it is an identity |
20 |
function when run on a little-endian machine, so calling it |
21 |
on such a platform causes no harm apart from wasting time. |
22 |
If the platform is known to be little-endian, we speed |
23 |
things up by undefining HIGHFIRST, which defines |
24 |
byteReverse as a null macro. Doing things in this manner |
25 |
insures we work on new platforms regardless of their byte |
26 |
order. */ |
27 |
|
28 |
#define HIGHFIRST |
29 |
|
30 |
#ifdef __i386__ |
31 |
#undef HIGHFIRST |
32 |
#endif |
33 |
|
34 |
#include <inttypes.h> |
35 |
|
36 |
struct MD5Context |
37 |
{ |
38 |
uint32_t buf[4]; |
39 |
uint32_t bits[2]; |
40 |
unsigned char in[64]; |
41 |
}; |
42 |
|
43 |
E void MD5Init (MD5Context *ctx); |
44 |
E void MD5Update (MD5Context *ctx, unsigned char const *buf, unsigned len); |
45 |
E void MD5Final (unsigned char digest[16], MD5Context *ctx); |
46 |
E void MD5Transform (uint32_t buf[4], uint32_t in[16]); |
47 |
|
48 |
/* |
49 |
* This is needed to make RSAREF happy on some MS-DOS compilers. |
50 |
*/ |
51 |
typedef struct MD5Context MD5_CTX; |
52 |
|
53 |
/* Define CHECK_HARDWARE_PROPERTIES to have main,c verify |
54 |
byte order and uint32 settings. */ |
55 |
#define CHECK_HARDWARE_PROPERTIES |
56 |
|
57 |
#endif /* !MD5_H */ |