MD5 sum computation algorithm. More...
#include <MD5Sum.h>
Public Types | |
typedef boost::array< uint32_t, 4 > | Digest |
Definition of the MD5 sum digest type. More... | |
Public Member Functions | |
void | clear () |
Clear the MD5 sum. More... | |
Digest | getDigest () const |
Retrieve the MD5 sum's digest. More... | |
size_t | getNumDigestedBits () const |
Retrieve the MD5 sum's number of digested bits. More... | |
MD5Sum (const std::string &text=std::string()) | |
Default constructor. More... | |
MD5Sum (const MD5Sum &src) | |
Copy constructor. More... | |
MD5Sum & | operator<< (const std::string &text) |
Stream operator for updating the MD5 sum. More... | |
std::string | toString () const |
Convert the MD5 sum to a hexadecimal format string. More... | |
void | update (const std::string &text) |
Update the MD5 sum using the given string. More... | |
void | write (std::ostream &stream) const |
Write the MD5 sum to a stream. More... | |
~MD5Sum () | |
Destructor. More... | |
Protected Types | |
typedef boost::array< uint32_t, 16 > | Block |
Definition of the MD5 sum block type. More... | |
typedef boost::array< uint32_t, 2 > | Size |
Definition of the MD5 sum size type. More... | |
Protected Member Functions | |
void | update (const uint8_t *bytes, size_t numBytes) |
Update the MD5 sum using the given array of bytes. More... | |
Static Protected Member Functions | |
static void | finalize (Digest &digest, Size &numDigestedBits, Block &buffer) |
Compute the finalized digest. More... | |
static uint32_t | rotateLeft (uint32_t value, size_t numBits) |
Perform bit rotation on a digest element. More... | |
static void | transform (const Block &block, Digest &digest) |
Transform a block. More... | |
static void | update (Digest &digest, Size &numDigestedBits, Block &buffer, const uint8_t *bytes, size_t numBytes) |
Update a digest and its context. More... | |
Protected Attributes | |
Block | buffer |
The buffered bytes which did not fit into the last block. More... | |
Digest | digest |
The current digest. More... | |
Size | numDigestedBits |
The number of digested bits. More... | |
Static Protected Attributes | |
static const boost::array< uint32_t, 64 > | constants |
Constants according to the MD5 algorithm. More... | |
static const Digest | initialDigest |
Initial digest. More... | |
static const boost::array< uint32_t, 64 > | numBitRotations |
Number of bit rotations per round according to the MD5 algorithm. More... | |
static const Block | padding |
Padding required to fill the last MD5 block for finalization. More... | |
MD5 sum computation algorithm.
This class implements the Message-Digest Algorithm 5 for computing the MD5 sum of a string.
|
protected |
typedef boost::array<uint32_t, 4> variant_topic_tools::MD5Sum::Digest |
|
protected |
variant_topic_tools::MD5Sum::MD5Sum | ( | const std::string & | text = std::string() | ) |
Default constructor.
Definition at line 68 of file MD5Sum.cpp.
variant_topic_tools::MD5Sum::MD5Sum | ( | const MD5Sum & | src | ) |
Copy constructor.
Definition at line 73 of file MD5Sum.cpp.
variant_topic_tools::MD5Sum::~MD5Sum | ( | ) |
Destructor.
Definition at line 79 of file MD5Sum.cpp.
void variant_topic_tools::MD5Sum::clear | ( | ) |
Clear the MD5 sum.
Definition at line 117 of file MD5Sum.cpp.
|
staticprotected |
Compute the finalized digest.
Definition at line 217 of file MD5Sum.cpp.
MD5Sum::Digest variant_topic_tools::MD5Sum::getDigest | ( | ) | const |
Retrieve the MD5 sum's digest.
Definition at line 94 of file MD5Sum.cpp.
size_t variant_topic_tools::MD5Sum::getNumDigestedBits | ( | ) | const |
Retrieve the MD5 sum's number of digested bits.
Definition at line 86 of file MD5Sum.cpp.
MD5Sum & variant_topic_tools::MD5Sum::operator<< | ( | const std::string & | text | ) |
Stream operator for updating the MD5 sum.
Definition at line 232 of file MD5Sum.cpp.
|
staticprotected |
Perform bit rotation on a digest element.
Definition at line 181 of file MD5Sum.cpp.
std::string variant_topic_tools::MD5Sum::toString | ( | ) | const |
Convert the MD5 sum to a hexadecimal format string.
Definition at line 128 of file MD5Sum.cpp.
|
staticprotected |
Transform a block.
Definition at line 142 of file MD5Sum.cpp.
void variant_topic_tools::MD5Sum::update | ( | const std::string & | text | ) |
Update the MD5 sum using the given string.
Definition at line 108 of file MD5Sum.cpp.
|
protected |
Update the MD5 sum using the given array of bytes.
Definition at line 113 of file MD5Sum.cpp.
|
staticprotected |
Update a digest and its context.
Definition at line 185 of file MD5Sum.cpp.
void variant_topic_tools::MD5Sum::write | ( | std::ostream & | stream | ) | const |
Write the MD5 sum to a stream.
Definition at line 124 of file MD5Sum.cpp.
|
protected |
|
staticprotected |
Constants according to the MD5 algorithm.
|
protected |
|
staticprotected |
|
staticprotected |
Number of bit rotations per round according to the MD5 algorithm.
|
protected |
|
staticprotected |
Padding required to fill the last MD5 block for finalization.