LibPkg
|
A class for producing MD5 message digests. More...
#include <md5.h>
Public Types | |
typedef unsigned long | uint32 |
A type to represent an unsigned 32-bit integer. More... | |
typedef unsigned long long | uint64 |
A type to represent an unsigned 64-bit integer. More... | |
Public Member Functions | |
md5 () | |
Construct MD5 object. More... | |
void | operator() (const void *data, size_t length) |
Process data in memory. More... | |
void | operator() (std::istream &in) |
Process data from stream. More... | |
void | operator() () |
Flush buffer. More... | |
uint32 | operator[] (unsigned int index) |
Read word from message digest. More... | |
operator string () | |
Convert message digest to hexadecimal string. More... | |
A class for producing MD5 message digests.
MD5 is a message digest algorithm published by Ron Rivest in 1992. It takes a message of arbitrary length and produces a 128-bit digest. A specification for the algorithm can be found in RFC 1321 and this implementation follows that specification very closely. It is not, however, derived from the reference implementation given in appendix A
typedef unsigned long pkg::md5::uint32 |
A type to represent an unsigned 32-bit integer.
typedef unsigned long long pkg::md5::uint64 |
A type to represent an unsigned 64-bit integer.
pkg::md5::md5 | ( | ) |
Construct MD5 object.
void pkg::md5::operator() | ( | const void * | data, |
size_t | length | ||
) |
Process data in memory.
The specified number of bytes are transferred from memory to the input buffer. Any complete blocks of 16 bytes are incorporated into the message digest state.
data | a pointer to the data |
length | the length of the data in bytes |
void pkg::md5::operator() | ( | std::istream & | in | ) |
Process data from stream.
Bytes are transferred from the stream to the input buffer until the end of file is reached. Any complete blocks of 16 bytes are incorporated into the message digest state.
in | the input stream from which the data is to be read |
References operator()().
void pkg::md5::operator() | ( | ) |
Flush buffer.
The final value of the message digest is calculated by processing any bytes still remaining in the buffer, followed by between 1 and 16 bytes of padding,
Referenced by operator()().
|
inline |
Read word from message digest.
The digest is presented as an array of four 32-bit words. Although this function may be called at any time, the result is only meaningful after the buffer has been flushed. Its effect is undefined if the index falls outside the range 0 to 3 inclusive.
index | the index of the word to be read |
pkg::md5::operator string | ( | ) |
Convert message digest to hexadecimal string.
The digest is presented low-order byte, high-order nybble first. Although this function may be called at any time, the result is only meaningful after the buffer has been flushed.
Reference Manual | LibPkg | Version 0.9.0 (4 Sep 2020) |