bcftools.1 and samtools.1 were merged in upstream release 0.1.17.
[samtools.git] / misc / md5.h
1 /*
2   This file is adapted from a program in this page:
3
4   http://www.fourmilab.ch/md5/
5
6   The original source code does not work on 64-bit machines due to the
7   wrong typedef "uint32". I also added prototypes.
8
9   -lh3
10  */
11
12 #ifndef MD5_H
13 #define MD5_H
14
15 /*  The following tests optimise behaviour on little-endian
16     machines, where there is no need to reverse the byte order
17     of 32 bit words in the MD5 computation.  By default,
18     HIGHFIRST is defined, which indicates we're running on a
19     big-endian (most significant byte first) machine, on which
20     the byteReverse function in md5.c must be invoked. However,
21     byteReverse is coded in such a way that it is an identity
22     function when run on a little-endian machine, so calling it
23     on such a platform causes no harm apart from wasting time. 
24     If the platform is known to be little-endian, we speed
25     things up by undefining HIGHFIRST, which defines
26     byteReverse as a null macro.  Doing things in this manner
27     insures we work on new platforms regardless of their byte
28     order.  */
29
30 #define HIGHFIRST
31
32 #if __LITTLE_ENDIAN__ != 0
33 #undef HIGHFIRST
34 #endif
35
36 #include <stdint.h>
37
38 struct MD5Context {
39         uint32_t buf[4];
40         uint32_t bits[2];
41         unsigned char in[64];
42 };
43
44 void MD5Init(struct MD5Context *ctx);
45 void MD5Update(struct MD5Context *ctx, unsigned char *buf, unsigned len);
46 void MD5Final(unsigned char digest[16], struct MD5Context *ctx);
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_t settings.  */
55 #define CHECK_HARDWARE_PROPERTIES
56
57 #endif /* !MD5_H */