cctools
Data Structures | Functions
md5.h File Reference

Routines for computing MD5 checksums. More...

#include <stdint.h>
#include <stdlib.h>

Go to the source code of this file.

Data Structures

struct  md5_context_t
 

Functions

void md5_buffer (const void *buffer, size_t length, unsigned char digest[MD5_DIGEST_LENGTH])
 Checksum a memory buffer. More...
 
int md5_file (const char *filename, unsigned char digest[MD5_DIGEST_LENGTH])
 Checksum a local file. More...
 
const char * md5_string (unsigned char digest[MD5_DIGEST_LENGTH])
 Convert an MD5 digest into a printable string. More...
 

Detailed Description

Routines for computing MD5 checksums.

Function Documentation

void md5_buffer ( const void *  buffer,
size_t  length,
unsigned char  digest[MD5_DIGEST_LENGTH] 
)

Checksum a memory buffer.

Note that this function produces a digest in binary form which must be converted to a human readable form with md5_string.

Parameters
bufferPointer to a memory buffer.
lengthLength of the buffer in bytes.
digestPointer to a buffer to store the digest.
int md5_file ( const char *  filename,
unsigned char  digest[MD5_DIGEST_LENGTH] 
)

Checksum a local file.

Note that this function produces a digest in binary form which must be converted to a human readable form with md5_string.

Parameters
filenamePath to the file to checksum.
digestPointer to a buffer to store the digest.
Returns
One on success, zero on failure.
const char* md5_string ( unsigned char  digest[MD5_DIGEST_LENGTH])

Convert an MD5 digest into a printable string.

Parameters
digestA binary digest returned from md5_file, md5_buffer, or chirp_reli_md5.
Returns
A static pointer to a human readable form of the digest.