annotate pyPRADA_1.2/tools/samtools-0.1.16/misc/md5.h @ 3:f17965495ec9 draft default tip

Uploaded
author siyuan
date Tue, 11 Mar 2014 12:14:01 -0400
parents acc2ca1a3ba4
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
acc2ca1a3ba4 Uploaded
siyuan
parents:
diff changeset
1 /*
acc2ca1a3ba4 Uploaded
siyuan
parents:
diff changeset
2 This file is adapted from a program in this page:
acc2ca1a3ba4 Uploaded
siyuan
parents:
diff changeset
3
acc2ca1a3ba4 Uploaded
siyuan
parents:
diff changeset
4 http://www.fourmilab.ch/md5/
acc2ca1a3ba4 Uploaded
siyuan
parents:
diff changeset
5
acc2ca1a3ba4 Uploaded
siyuan
parents:
diff changeset
6 The original source code does not work on 64-bit machines due to the
acc2ca1a3ba4 Uploaded
siyuan
parents:
diff changeset
7 wrong typedef "uint32". I also added prototypes.
acc2ca1a3ba4 Uploaded
siyuan
parents:
diff changeset
8
acc2ca1a3ba4 Uploaded
siyuan
parents:
diff changeset
9 -lh3
acc2ca1a3ba4 Uploaded
siyuan
parents:
diff changeset
10 */
acc2ca1a3ba4 Uploaded
siyuan
parents:
diff changeset
11
acc2ca1a3ba4 Uploaded
siyuan
parents:
diff changeset
12 #ifndef MD5_H
acc2ca1a3ba4 Uploaded
siyuan
parents:
diff changeset
13 #define MD5_H
acc2ca1a3ba4 Uploaded
siyuan
parents:
diff changeset
14
acc2ca1a3ba4 Uploaded
siyuan
parents:
diff changeset
15 /* The following tests optimise behaviour on little-endian
acc2ca1a3ba4 Uploaded
siyuan
parents:
diff changeset
16 machines, where there is no need to reverse the byte order
acc2ca1a3ba4 Uploaded
siyuan
parents:
diff changeset
17 of 32 bit words in the MD5 computation. By default,
acc2ca1a3ba4 Uploaded
siyuan
parents:
diff changeset
18 HIGHFIRST is defined, which indicates we're running on a
acc2ca1a3ba4 Uploaded
siyuan
parents:
diff changeset
19 big-endian (most significant byte first) machine, on which
acc2ca1a3ba4 Uploaded
siyuan
parents:
diff changeset
20 the byteReverse function in md5.c must be invoked. However,
acc2ca1a3ba4 Uploaded
siyuan
parents:
diff changeset
21 byteReverse is coded in such a way that it is an identity
acc2ca1a3ba4 Uploaded
siyuan
parents:
diff changeset
22 function when run on a little-endian machine, so calling it
acc2ca1a3ba4 Uploaded
siyuan
parents:
diff changeset
23 on such a platform causes no harm apart from wasting time.
acc2ca1a3ba4 Uploaded
siyuan
parents:
diff changeset
24 If the platform is known to be little-endian, we speed
acc2ca1a3ba4 Uploaded
siyuan
parents:
diff changeset
25 things up by undefining HIGHFIRST, which defines
acc2ca1a3ba4 Uploaded
siyuan
parents:
diff changeset
26 byteReverse as a null macro. Doing things in this manner
acc2ca1a3ba4 Uploaded
siyuan
parents:
diff changeset
27 insures we work on new platforms regardless of their byte
acc2ca1a3ba4 Uploaded
siyuan
parents:
diff changeset
28 order. */
acc2ca1a3ba4 Uploaded
siyuan
parents:
diff changeset
29
acc2ca1a3ba4 Uploaded
siyuan
parents:
diff changeset
30 #define HIGHFIRST
acc2ca1a3ba4 Uploaded
siyuan
parents:
diff changeset
31
acc2ca1a3ba4 Uploaded
siyuan
parents:
diff changeset
32 #if __LITTLE_ENDIAN__ != 0
acc2ca1a3ba4 Uploaded
siyuan
parents:
diff changeset
33 #undef HIGHFIRST
acc2ca1a3ba4 Uploaded
siyuan
parents:
diff changeset
34 #endif
acc2ca1a3ba4 Uploaded
siyuan
parents:
diff changeset
35
acc2ca1a3ba4 Uploaded
siyuan
parents:
diff changeset
36 #include <stdint.h>
acc2ca1a3ba4 Uploaded
siyuan
parents:
diff changeset
37
acc2ca1a3ba4 Uploaded
siyuan
parents:
diff changeset
38 struct MD5Context {
acc2ca1a3ba4 Uploaded
siyuan
parents:
diff changeset
39 uint32_t buf[4];
acc2ca1a3ba4 Uploaded
siyuan
parents:
diff changeset
40 uint32_t bits[2];
acc2ca1a3ba4 Uploaded
siyuan
parents:
diff changeset
41 unsigned char in[64];
acc2ca1a3ba4 Uploaded
siyuan
parents:
diff changeset
42 };
acc2ca1a3ba4 Uploaded
siyuan
parents:
diff changeset
43
acc2ca1a3ba4 Uploaded
siyuan
parents:
diff changeset
44 void MD5Init(struct MD5Context *ctx);
acc2ca1a3ba4 Uploaded
siyuan
parents:
diff changeset
45 void MD5Update(struct MD5Context *ctx, unsigned char *buf, unsigned len);
acc2ca1a3ba4 Uploaded
siyuan
parents:
diff changeset
46 void MD5Final(unsigned char digest[16], struct MD5Context *ctx);
acc2ca1a3ba4 Uploaded
siyuan
parents:
diff changeset
47
acc2ca1a3ba4 Uploaded
siyuan
parents:
diff changeset
48 /*
acc2ca1a3ba4 Uploaded
siyuan
parents:
diff changeset
49 * This is needed to make RSAREF happy on some MS-DOS compilers.
acc2ca1a3ba4 Uploaded
siyuan
parents:
diff changeset
50 */
acc2ca1a3ba4 Uploaded
siyuan
parents:
diff changeset
51 typedef struct MD5Context MD5_CTX;
acc2ca1a3ba4 Uploaded
siyuan
parents:
diff changeset
52
acc2ca1a3ba4 Uploaded
siyuan
parents:
diff changeset
53 /* Define CHECK_HARDWARE_PROPERTIES to have main,c verify
acc2ca1a3ba4 Uploaded
siyuan
parents:
diff changeset
54 byte order and uint32_t settings. */
acc2ca1a3ba4 Uploaded
siyuan
parents:
diff changeset
55 #define CHECK_HARDWARE_PROPERTIES
acc2ca1a3ba4 Uploaded
siyuan
parents:
diff changeset
56
acc2ca1a3ba4 Uploaded
siyuan
parents:
diff changeset
57 #endif /* !MD5_H */