annotate PsiCLASS-1.0.2/samtools-0.1.19/misc/md5.h @ 0:903fc43d6227 draft default tip

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