MD5 message digest class.
More...
#include <gmd5.h>
|
| Md5 () |
| Default constructor. More...
|
|
| Md5 (const std::string &state) |
| Constructor using an intermediate state() string. More...
|
|
std::string | state () const |
| Returns the current intermediate state as a 20 character string, although this requires the size of the added data is a multiple of the blocksize(). More...
|
|
void | add (const std::string &data) |
| Adds more data. More...
|
|
std::string | value () |
| Returns the hash value as a 16-character string. More...
|
|
| Md5 (const Md5 &)=delete |
|
| Md5 (Md5 &&)=delete |
|
void | operator= (const Md5 &)=delete |
|
void | operator= (Md5 &&)=delete |
|
|
static std::size_t | blocksize () |
| Returns the block size in bytes (64). More...
|
|
static std::size_t | valuesize () |
| Returns the value() size in bytes (16). More...
|
|
static std::size_t | statesize () |
| Returns the size of the state() string (20). More...
|
|
static std::string | digest (const std::string &input) |
| A convenience function that returns a digest from one input. More...
|
|
static std::string | digest (const std::string &input_1, const std::string &input_2) |
| A convenience function that returns a digest from two inputs. More...
|
|
static std::string | digest2 (const std::string &input_1, const std::string &input_2) |
| A non-overloaded name for the digest() overload taking two parameters. More...
|
|
static std::string | predigest (const std::string &padded_key) |
| A convenience function that add()s the given string of length blocksize() (typically a padded key) and returns the resulting state() truncated to valuesize() characters. More...
|
|
static std::string | postdigest (const std::string &state_pair, const std::string &message) |
| A convenience function that returns the value() from an outer digest that is initialised with the second half of the state pair, and with the value() of an inner digest add()ed; the inner digest being initialised with the first half of the state pair, and with the given message add()ed. More...
|
|
MD5 message digest class.
Eg:
std::string x = ... ;
std::string y = ... ;
assert( (x.size() % 64U) == 0 ) ;
h1.add( x ) ;
h2.add( y ) ;
static std::string digest(const std::string &input)
A convenience function that returns a digest from one input.
Md5()
Default constructor.
Definition at line 48 of file gmd5.h.
◆ big_t
using G::Md5::big_t = std::size_t |
◆ small_t
using G::Md5::small_t = std::size_t |
◆ Md5() [1/2]
Default constructor.
Definition at line 493 of file gmd5.cpp.
◆ Md5() [2/2]
G::Md5::Md5 |
( |
const std::string & |
state | ) |
|
|
explicit |
Constructor using an intermediate state() string.
Precondition: state.size() == 20
Definition at line 498 of file gmd5.cpp.
◆ add()
void G::Md5::add |
( |
const std::string & |
data | ) |
|
Adds more data.
Definition at line 510 of file gmd5.cpp.
◆ blocksize()
std::size_t G::Md5::blocksize |
( |
| ) |
|
|
static |
Returns the block size in bytes (64).
Definition at line 580 of file gmd5.cpp.
◆ digest() [1/2]
std::string G::Md5::digest |
( |
const std::string & |
input | ) |
|
|
static |
A convenience function that returns a digest from one input.
Definition at line 535 of file gmd5.cpp.
◆ digest() [2/2]
std::string G::Md5::digest |
( |
const std::string & |
input_1, |
|
|
const std::string & |
input_2 |
|
) |
| |
|
static |
A convenience function that returns a digest from two inputs.
Definition at line 541 of file gmd5.cpp.
◆ digest2()
std::string G::Md5::digest2 |
( |
const std::string & |
input_1, |
|
|
const std::string & |
input_2 |
|
) |
| |
|
static |
A non-overloaded name for the digest() overload taking two parameters.
Definition at line 549 of file gmd5.cpp.
◆ postdigest()
std::string G::Md5::postdigest |
( |
const std::string & |
state_pair, |
|
|
const std::string & |
message |
|
) |
| |
|
static |
A convenience function that returns the value() from an outer digest that is initialised with the second half of the state pair, and with the value() of an inner digest add()ed; the inner digest being initialised with the first half of the state pair, and with the given message add()ed.
The result is a string of 32 non-printing characters. Throws InvalidState if the state-pair string is not valid.
Definition at line 562 of file gmd5.cpp.
◆ predigest()
std::string G::Md5::predigest |
( |
const std::string & |
padded_key | ) |
|
|
static |
◆ state()
std::string G::Md5::state |
( |
| ) |
const |
Returns the current intermediate state as a 20 character string, although this requires the size of the added data is a multiple of the blocksize().
Note that the trailing 4 characters represent the total size of the added data.
- See also
- G::HashState
Definition at line 504 of file gmd5.cpp.
◆ statesize()
std::size_t G::Md5::statesize |
( |
| ) |
|
|
static |
◆ value()
std::string G::Md5::value |
( |
| ) |
|
Returns the hash value as a 16-character string.
No more add()s are allowed. The resulting string is not generally printable and it may have embedded nulls.
- See also
- G::HashState, G::Hash::printable().
Definition at line 525 of file gmd5.cpp.
◆ valuesize()
std::size_t G::Md5::valuesize |
( |
| ) |
|
|
static |
The documentation for this class was generated from the following files:
- /usr/src/slapt-src-x86_64/network/emailrelay/emailrelay-2.3/src/glib/gmd5.h
- /usr/src/slapt-src-x86_64/network/emailrelay/emailrelay-2.3/src/glib/gmd5.cpp