xref: /aosp_15_r20/external/libaom/common/md5_utils.h (revision 77c1e3ccc04c968bd2bc212e87364f250e820521)
1*77c1e3ccSAndroid Build Coastguard Worker /*
2*77c1e3ccSAndroid Build Coastguard Worker  * This is the header file for the MD5 message-digest algorithm.
3*77c1e3ccSAndroid Build Coastguard Worker  * The algorithm is due to Ron Rivest.  This code was
4*77c1e3ccSAndroid Build Coastguard Worker  * written by Colin Plumb in 1993, no copyright is claimed.
5*77c1e3ccSAndroid Build Coastguard Worker  * This code is in the public domain; do with it what you wish.
6*77c1e3ccSAndroid Build Coastguard Worker  *
7*77c1e3ccSAndroid Build Coastguard Worker  * Equivalent code is available from RSA Data Security, Inc.
8*77c1e3ccSAndroid Build Coastguard Worker  * This code has been tested against that, and is equivalent,
9*77c1e3ccSAndroid Build Coastguard Worker  * except that you don't need to include two pages of legalese
10*77c1e3ccSAndroid Build Coastguard Worker  * with every copy.
11*77c1e3ccSAndroid Build Coastguard Worker  *
12*77c1e3ccSAndroid Build Coastguard Worker  * To compute the message digest of a chunk of bytes, declare an
13*77c1e3ccSAndroid Build Coastguard Worker  * MD5Context structure, pass it to MD5Init, call MD5Update as
14*77c1e3ccSAndroid Build Coastguard Worker  * needed on buffers full of bytes, and then call MD5Final, which
15*77c1e3ccSAndroid Build Coastguard Worker  * will fill a supplied 16-byte array with the digest.
16*77c1e3ccSAndroid Build Coastguard Worker  *
17*77c1e3ccSAndroid Build Coastguard Worker  * Changed so as no longer to depend on Colin Plumb's `usual.h'
18*77c1e3ccSAndroid Build Coastguard Worker  * header definitions
19*77c1e3ccSAndroid Build Coastguard Worker  *  - Ian Jackson <[email protected]>.
20*77c1e3ccSAndroid Build Coastguard Worker  * Still in the public domain.
21*77c1e3ccSAndroid Build Coastguard Worker  */
22*77c1e3ccSAndroid Build Coastguard Worker 
23*77c1e3ccSAndroid Build Coastguard Worker #ifndef AOM_COMMON_MD5_UTILS_H_
24*77c1e3ccSAndroid Build Coastguard Worker #define AOM_COMMON_MD5_UTILS_H_
25*77c1e3ccSAndroid Build Coastguard Worker 
26*77c1e3ccSAndroid Build Coastguard Worker #ifdef __cplusplus
27*77c1e3ccSAndroid Build Coastguard Worker extern "C" {
28*77c1e3ccSAndroid Build Coastguard Worker #endif
29*77c1e3ccSAndroid Build Coastguard Worker 
30*77c1e3ccSAndroid Build Coastguard Worker #define md5byte unsigned char
31*77c1e3ccSAndroid Build Coastguard Worker #define UWORD32 unsigned int
32*77c1e3ccSAndroid Build Coastguard Worker 
33*77c1e3ccSAndroid Build Coastguard Worker typedef struct MD5Context MD5Context;
34*77c1e3ccSAndroid Build Coastguard Worker struct MD5Context {
35*77c1e3ccSAndroid Build Coastguard Worker   UWORD32 buf[4];
36*77c1e3ccSAndroid Build Coastguard Worker   UWORD32 bytes[2];
37*77c1e3ccSAndroid Build Coastguard Worker   UWORD32 in[16];
38*77c1e3ccSAndroid Build Coastguard Worker };
39*77c1e3ccSAndroid Build Coastguard Worker 
40*77c1e3ccSAndroid Build Coastguard Worker void MD5Init(struct MD5Context *context);
41*77c1e3ccSAndroid Build Coastguard Worker void MD5Update(struct MD5Context *context, md5byte const *buf, unsigned len);
42*77c1e3ccSAndroid Build Coastguard Worker void MD5Final(unsigned char digest[16], struct MD5Context *context);
43*77c1e3ccSAndroid Build Coastguard Worker void MD5Transform(UWORD32 buf[4], UWORD32 const in[16]);
44*77c1e3ccSAndroid Build Coastguard Worker 
45*77c1e3ccSAndroid Build Coastguard Worker #ifdef __cplusplus
46*77c1e3ccSAndroid Build Coastguard Worker }  // extern "C"
47*77c1e3ccSAndroid Build Coastguard Worker #endif
48*77c1e3ccSAndroid Build Coastguard Worker 
49*77c1e3ccSAndroid Build Coastguard Worker #endif  // AOM_COMMON_MD5_UTILS_H_
50