#include <mimotera++/MD5.hh>
Public Types | |
typedef unsigned int | size_type |
Public Member Functions | |
MD5 () | |
MD5 (const std::string &text) | |
void | update (const unsigned char *buf, size_type length) |
void | update (const char *buf, size_type length) |
MD5 & | finalize () |
std::string | hexdigest () const |
void | print (std::ostream &os) const |
This class is computing the MD5 hash (or finger print) of a file or a block of bytes. It is not meant to be either fast or secure, but it is reliable enough to be used as a debug tool in understanding if two files are the same or not.
This code is derived from the "RSA Data Security, Inc. MD5 Message-Digest Algorithm" and this is the license to copy and use coming with this code.
Copyright (C) 1991-2, RSA Data Security, Inc. Created 1991. All rights reserved.
License to copy and use this software is granted provided that it is identified as the "RSA Data Security, Inc. MD5 Message-Digest Algorithm" in all material mentioning or referencing this software or this function.
License is also granted to make and use derivative works provided that such works are identified as "derived from the RSA Data Security, Inc. MD5 Message-Digest Algorithm" in all material mentioning or referencing the derived work.
RSA Data Security, Inc. makes no representations concerning either the merchantability of this software or the suitability of this software for any particular purpose. It is provided "as is" without express or implied warranty of any kind.
These notices must be retained in any copies of any part of this documentation and/or software.
The use is very simple and self examplaining.
Definition at line 76 of file MD5.hh.
typedef unsigned int MD5::size_type |
MD5::MD5 | ( | const std::string & | text | ) |
Default constructor with a string of text in input
text | The text for MD5 calculation |
Definition at line 110 of file MD5.cc.
References finalize(), and update().
MD5 & MD5::finalize | ( | ) |
std::string MD5::hexdigest | ( | ) | const |
void MD5::print | ( | std::ostream & | os | ) | const |
os | The output streamer |
Definition at line 341 of file MD5.cc.
References hexdigest().
Referenced by operator<<().
void MD5::update | ( | const char * | buf, | |
size_type | length | |||
) |
Update method
buf | An array of signed char | |
length | Length of the buffer |
void MD5::update | ( | const unsigned char * | buf, | |
size_type | length | |||
) |
Update method
buf | An array of unsigned char | |
length | Length of the buffer |
Referenced by finalize(), and MD5().