This repository has been archived by the owner on Feb 11, 2021. It is now read-only.
/
utl_md5.h
executable file
·125 lines (106 loc) · 3.62 KB
/
utl_md5.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
/*
***********************************************************************
** utl_md5.h -- header file for implementation of MD5 **
** RSA Data Security, Inc. MD5 Message-Digest Algorithm **
** Created: 2/17/90 RLR **
** Revised: 12/27/90 SRD,AJ,BSK,JT Reference C version **
** Revised (for MD5): RLR 4/27/91 **
** -- G modified to have y&~z instead of y&z **
** -- FF, GG, HH modified to add in last register done **
** -- Access pattern: round 2 works mod 5, round 3 works mod 3 **
** -- distinct additive constant for each step **
** -- round 4 added, working mod 7 **
***********************************************************************
*/
/*
***********************************************************************
** Message-digest routines: **
** To form the message digest for a message M **
** (1) Initialize a context buffer mdContext using MD5Init **
** (2) Call MD5Update on mdContext and M **
** (3) Call MD5Final on mdContext **
** The message digest is now in mdContext->digest[0...15] **
***********************************************************************
*/
#ifndef _utl_md5_h
#define _utl_md5_h
/* Set up for C function definitions, even when using C++ */
#ifdef __cplusplus
extern "C" {
#endif
/* ------------ Definitions --------- */
/* typedef a 32-bit type */
typedef unsigned long int MD5UINT4;
/* Data structure for MD5 (Message-Digest) computation */
typedef struct {
MD5UINT4 i[2]; /* number of _bits_ handled mod 2^64 */
MD5UINT4 buf[4]; /* scratch buffer */
unsigned char in[64]; /* input buffer */
unsigned char digest[16]; /* actual digest after MD5Final call */
} MD5_CTX;
/* ---------- Function Prototypes ------------- */
#ifdef WIN32
#ifdef BUILD_DLL
#define DLLINTERFACE __declspec(dllexport)
#else
#define DLLINTERFACE __declspec(dllimport)
#endif
#else
#define DLLINTERFACE
#endif
/*
* utl_md5Init: initialize the context
*
* Parameters:
*
* mdContext pointer to context variable
*
* Return value:
*
* none
*
* Note: The function initializes the message-digest context
* mdContext. Call before each new use of the context -
* all fields are set to zero.
*/
DLLINTERFACE void utl_md5Init(MD5_CTX * mdContext);
/*
* utl_md5update: update digest from variable length data
*
* Parameters:
*
* mdContext pointer to context variable
* inBuf pointer to data array/string
* inLen length of data array/string
*
* Return value:
*
* none
*
* Note: The function updates the message-digest context to account
* for the presence of each of the characters inBuf[0..inLen-1]
* in the message whose digest is being computed.
*/
DLLINTERFACE void utl_md5Update(MD5_CTX * mdContext, unsigned char *inBuf,
unsigned int inLen);
/*
* utl_md5Final: complete digest computation
*
* Parameters:
*
* mdContext pointer to context variable
*
* Return value:
*
* none
*
* Note: The function terminates the message-digest computation and
* ends with the desired message digest in mdContext.digest[0..15].
* Always call before using the digest[] variable.
*/
DLLINTERFACE void utl_md5Final(MD5_CTX * mdContext);
/* Ends C function definitions when using C++ */
#ifdef __cplusplus
};
#endif
#endif /* _utl_md5_h */