PolarSSL v1.3.9
md5.h
Go to the documentation of this file.
1 
27 #ifndef POLARSSL_MD5_H
28 #define POLARSSL_MD5_H
29 
30 #if !defined(POLARSSL_CONFIG_FILE)
31 #include "config.h"
32 #else
33 #include POLARSSL_CONFIG_FILE
34 #endif
35 
36 #include <string.h>
37 
38 #if defined(_MSC_VER) && !defined(EFIX64) && !defined(EFI32)
39 #include <basetsd.h>
40 typedef UINT32 uint32_t;
41 #else
42 #include <inttypes.h>
43 #endif
44 
45 #define POLARSSL_ERR_MD5_FILE_IO_ERROR -0x0074
47 #if !defined(POLARSSL_MD5_ALT)
48 // Regular implementation
49 //
50 
51 #ifdef __cplusplus
52 extern "C" {
53 #endif
54 
58 typedef struct
59 {
60  uint32_t total[2];
61  uint32_t state[4];
62  unsigned char buffer[64];
64  unsigned char ipad[64];
65  unsigned char opad[64];
66 }
68 
74 void md5_init( md5_context *ctx );
75 
81 void md5_free( md5_context *ctx );
82 
88 void md5_starts( md5_context *ctx );
89 
97 void md5_update( md5_context *ctx, const unsigned char *input, size_t ilen );
98 
105 void md5_finish( md5_context *ctx, unsigned char output[16] );
106 
107 /* Internal use */
108 void md5_process( md5_context *ctx, const unsigned char data[64] );
109 
110 #ifdef __cplusplus
111 }
112 #endif
113 
114 #else /* POLARSSL_MD5_ALT */
115 #include "md5_alt.h"
116 #endif /* POLARSSL_MD5_ALT */
117 
118 #ifdef __cplusplus
119 extern "C" {
120 #endif
121 
129 void md5( const unsigned char *input, size_t ilen, unsigned char output[16] );
130 
139 int md5_file( const char *path, unsigned char output[16] );
140 
148 void md5_hmac_starts( md5_context *ctx,
149  const unsigned char *key, size_t keylen );
150 
158 void md5_hmac_update( md5_context *ctx,
159  const unsigned char *input, size_t ilen );
160 
167 void md5_hmac_finish( md5_context *ctx, unsigned char output[16] );
168 
174 void md5_hmac_reset( md5_context *ctx );
175 
185 void md5_hmac( const unsigned char *key, size_t keylen,
186  const unsigned char *input, size_t ilen,
187  unsigned char output[16] );
188 
194 int md5_self_test( int verbose );
195 
196 #ifdef __cplusplus
197 }
198 #endif
199 
200 #endif /* md5.h */