E-MailRelay

- Main Page
- Namespaces
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

Classes | Public Types | Public Member Functions | Static Public Member Functions | List of all members
G::Md5 Class Reference

MD5 message digest class. More...

`#include <gmd5.h>`

## Classes
struct | digest_state
| Holds the four parts of the md5 state. More...
struct | digest_stream_state
| Holds the md5 state plus unprocessed residual data. More...

## Public Types
typedef size_t | big_t
typedef size_t | small_t

## Public Member Functions
| Md5 ()
| Default constructor.
| Md5 (const std::string &state)
| Constructor using an intermediate state() string.
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.
std::string | value ()
| Returns the hash value as a 16-character string. More...

## Static Public Member Functions
static size_t | blocksize ()
| Returns the block size in bytes (64).
static size_t | valuesize ()
| Returns the value() size in bytes (16).
static size_t | statesize ()
| Returns the size of the state() string (20).
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...

## Detailed Description

MD5 message digest class.

Eg:

Md5 h1 ;
std::string x = ... ;
std::string y = ... ;
assert( (x.size() % 64U) == 0 ) ;
h1.add( x ) ;
Md5 h2( h1.state() ) ;
h2.add( y ) ;
assert( h2.value() == Md5::digest(x+y) ) ;

Definition at line 48 of file gmd5.h.

## Member Function Documentation

std::string G::Md5::digest | ( | const std::string & | input | ) |
| static

A convenience function that returns a digest from one input.

Definition at line 522 of file gmd5.cpp.

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 528 of file gmd5.cpp.

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 536 of file gmd5.cpp.

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.

Definition at line 549 of file gmd5.cpp.

std::string G::Md5::predigest | ( | const std::string & | padded_key | ) |
| static

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.

Definition at line 541 of file gmd5.cpp.

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 491 of file gmd5.cpp.

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 512 of file gmd5.cpp.

The documentation for this class was generated from the following files:

- /tmp/slackrepo/SBo/slackrepo.S3SYfd/build_emailrelay/emailrelay-2.0.1/src/glib/gmd5.h
- /tmp/slackrepo/SBo/slackrepo.S3SYfd/build_emailrelay/emailrelay-2.0.1/src/glib/gmd5.cpp