This is a C++ implementation of the RSA MD5 message digest algorithm. The algorithm calculates a 32 byte checksum for any data sequence (e.g., array of bytes, a string or a file). Full details of the MD5 algorithm are provided within the code.
Two projects are provided:
- MD5.dsw – builds a library that provides the MD5 calculation routines.
- MD5ChecksumTest.dsw – builds a modeless dialog test environment that demonstrates use of the MD5 library and provides a simple verification tool.
Wherever this implementation of the RSA MD5 algorithm is used, the RSA copyright notices etc. must be adhered to, as described within the code and the test application’s “About” box.
All use of this algorithm is at the users risk – no liability of any kind whatsoever is accepted by Nick Stone nor Langfine Ltd.
The MD5 message digest algorithm is wrapped in a C++ class named
Three public functions are exported:
CString GetMD5(BYTE* pBuf,
CString GetMD5(CFile& File);
CString GetMD5(const CString&
All are implemented as static functions. The checksum calculated is returned as a 32 character hexadecimal number held in a CString. GetMD5 is overloaded to take data to be checksummed as either an array of bytes or a file.
A test environment is provided in the project MD5ChecksumTest.dsw. This allows the user to type a string and see its checksum calculated in real time and also to select a file for checksum. Data files are provided containing simple test data; get the checksum for these and then try typing the file’s contents into the first edit box and compare the two checksums thus obtained (they should be the same!) The test environment also includes a “Self Test” button. This checksums each of the supplied test data files in turn and checks the calculated checksum with the known correct value.