cctools
md5.h
Go to the documentation of this file.
1 /*
2 Copyright (C) 2008- The University of Notre Dame
3 This software is distributed under the GNU General Public License.
4 See the file COPYING for details.
5 */
6 
7 #ifndef MD5_H
8 #define MD5_H
9 
10 #include <stdint.h>
11 #include <stdlib.h>
12 
17 #define MD5_DIGEST_LENGTH 16
18 #define MD5_DIGEST_LENGTH_HEX (MD5_DIGEST_LENGTH<<1)
19 
20 typedef struct {
21  uint32_t state[4];
22  uint32_t count[2];
23  uint8_t buffer[64];
25 
26 void md5_init(md5_context_t * ctx);
27 void md5_update(md5_context_t * ctx, const void *, size_t);
28 void md5_final(unsigned char digest[MD5_DIGEST_LENGTH], md5_context_t * ctx);
29 
38 void md5_buffer(const void *buffer, size_t length, unsigned char digest[MD5_DIGEST_LENGTH]);
39 
48 int md5_file(const char *filename, unsigned char digest[MD5_DIGEST_LENGTH]);
49 
55 const char *md5_string(unsigned char digest[MD5_DIGEST_LENGTH]);
56 
57 #endif
Definition: md5.h:20
const char * md5_string(unsigned char digest[MD5_DIGEST_LENGTH])
Convert an MD5 digest into a printable string.
void md5_buffer(const void *buffer, size_t length, unsigned char digest[MD5_DIGEST_LENGTH])
Checksum a memory buffer.
Definition: buffer.h:26
int md5_file(const char *filename, unsigned char digest[MD5_DIGEST_LENGTH])
Checksum a local file.