Public Types | Public Member Functions | Protected Types | Protected Member Functions | Static Protected Member Functions | Protected Attributes | Static Protected Attributes
variant_topic_tools::MD5Sum Class Reference

MD5 sum computation algorithm. More...

#include <MD5Sum.h>

List of all members.

Public Types

typedef boost::array< uint32_t, 4 > Digest
 Definition of the MD5 sum digest type.

Public Member Functions

void clear ()
 Clear the MD5 sum.
Digest getDigest () const
 Retrieve the MD5 sum's digest.
size_t getNumDigestedBits () const
 Retrieve the MD5 sum's number of digested bits.
 MD5Sum (const std::string &text=std::string())
 Default constructor.
 MD5Sum (const MD5Sum &src)
 Copy constructor.
MD5Sumoperator<< (const std::string &text)
 Stream operator for updating the MD5 sum.
std::string toString () const
 Convert the MD5 sum to a hexadecimal format string.
void update (const std::string &text)
 Update the MD5 sum using the given string.
void write (std::ostream &stream) const
 Write the MD5 sum to a stream.
 ~MD5Sum ()
 Destructor.

Protected Types

typedef boost::array< uint32_t, 16 > Block
 Definition of the MD5 sum block type.
typedef boost::array< uint32_t, 2 > Size
 Definition of the MD5 sum size type.

Protected Member Functions

void update (const uint8_t *bytes, size_t numBytes)
 Update the MD5 sum using the given array of bytes.

Static Protected Member Functions

static void finalize (Digest &digest, Size &numDigestedBits, Block &buffer)
 Compute the finalized digest.
static uint32_t rotateLeft (uint32_t value, size_t numBits)
 Perform bit rotation on a digest element.
static void transform (const Block &block, Digest &digest)
 Transform a block.
static void update (Digest &digest, Size &numDigestedBits, Block &buffer, const uint8_t *bytes, size_t numBytes)
 Update a digest and its context.

Protected Attributes

Block buffer
 The buffered bytes which did not fit into the last block.
Digest digest
 The current digest.
Size numDigestedBits
 The number of digested bits.

Static Protected Attributes

static const boost::array
< uint32_t, 64 > 
constants
 Constants according to the MD5 algorithm.
static const Digest initialDigest
 Initial digest.
static const boost::array
< uint32_t, 64 > 
numBitRotations
 Number of bit rotations per round according to the MD5 algorithm.
static const Block padding
 Padding required to fill the last MD5 block for finalization.

Detailed Description

MD5 sum computation algorithm.

This class implements the Message-Digest Algorithm 5 for computing the MD5 sum of a string.

Definition at line 36 of file MD5Sum.h.


Member Typedef Documentation

typedef boost::array<uint32_t, 16> variant_topic_tools::MD5Sum::Block [protected]

Definition of the MD5 sum block type.

Definition at line 89 of file MD5Sum.h.

typedef boost::array<uint32_t, 4> variant_topic_tools::MD5Sum::Digest

Definition of the MD5 sum digest type.

Definition at line 40 of file MD5Sum.h.

typedef boost::array<uint32_t, 2> variant_topic_tools::MD5Sum::Size [protected]

Definition of the MD5 sum size type.

Definition at line 85 of file MD5Sum.h.


Constructor & Destructor Documentation

variant_topic_tools::MD5Sum::MD5Sum ( const std::string &  text = std::string())

Default constructor.

Definition at line 68 of file MD5Sum.cpp.

Copy constructor.

Definition at line 73 of file MD5Sum.cpp.

Destructor.

Definition at line 79 of file MD5Sum.cpp.


Member Function Documentation

Clear the MD5 sum.

Definition at line 117 of file MD5Sum.cpp.

void variant_topic_tools::MD5Sum::finalize ( Digest digest,
Size numDigestedBits,
Block buffer 
) [static, protected]

Compute the finalized digest.

Definition at line 217 of file MD5Sum.cpp.

Retrieve the MD5 sum's digest.

Definition at line 94 of file MD5Sum.cpp.

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.

uint32_t variant_topic_tools::MD5Sum::rotateLeft ( uint32_t  value,
size_t  numBits 
) [static, protected]

Perform bit rotation on a digest element.

Definition at line 181 of file MD5Sum.cpp.

Convert the MD5 sum to a hexadecimal format string.

Definition at line 128 of file MD5Sum.cpp.

void variant_topic_tools::MD5Sum::transform ( const Block block,
Digest digest 
) [static, protected]

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.

void variant_topic_tools::MD5Sum::update ( const uint8_t *  bytes,
size_t  numBytes 
) [protected]

Update the MD5 sum using the given array of bytes.

Definition at line 113 of file MD5Sum.cpp.

void variant_topic_tools::MD5Sum::update ( Digest digest,
Size numDigestedBits,
Block buffer,
const uint8_t *  bytes,
size_t  numBytes 
) [static, protected]

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.


Member Data Documentation

The buffered bytes which did not fit into the last block.

Definition at line 118 of file MD5Sum.h.

const boost::array< uint32_t, 64 > variant_topic_tools::MD5Sum::constants [static, protected]
Initial value:
 {
  0xd76aa478, 0xe8c7b756, 0x242070db, 0xc1bdceee,
  0xf57c0faf, 0x4787c62a, 0xa8304613, 0xfd469501,
  0x698098d8, 0x8b44f7af, 0xffff5bb1, 0x895cd7be,
  0x6b901122, 0xfd987193, 0xa679438e, 0x49b40821,
  0xf61e2562, 0xc040b340, 0x265e5a51, 0xe9b6c7aa,
  0xd62f105d, 0x02441453, 0xd8a1e681, 0xe7d3fbc8,
  0x21e1cde6, 0xc33707d6, 0xf4d50d87, 0x455a14ed,
  0xa9e3e905, 0xfcefa3f8, 0x676f02d9, 0x8d2a4c8a,
  0xfffa3942, 0x8771f681, 0x6d9d6122, 0xfde5380c,
  0xa4beea44, 0x4bdecfa9, 0xf6bb4b60, 0xbebfbc70,
  0x289b7ec6, 0xeaa127fa, 0xd4ef3085, 0x04881d05,
  0xd9d4d039, 0xe6db99e5, 0x1fa27cf8, 0xc4ac5665,
  0xf4292244, 0x432aff97, 0xab9423a7, 0xfc93a039,
  0x655b59c3, 0x8f0ccc92, 0xffeff47d, 0x85845dd1,
  0x6fa87e4f, 0xfe2ce6e0, 0xa3014314, 0x4e0811a1,
  0xf7537e82, 0xbd3af235, 0x2ad7d2bb, 0xeb86d391
}

Constants according to the MD5 algorithm.

Definition at line 102 of file MD5Sum.h.

The current digest.

Definition at line 110 of file MD5Sum.h.

Initial value:
 {
  0x67452301, 0xefcdab89, 0x98badcfe, 0x10325476
}

Initial digest.

Definition at line 93 of file MD5Sum.h.

const boost::array< uint32_t, 64 > variant_topic_tools::MD5Sum::numBitRotations [static, protected]
Initial value:
 {
  7, 12, 17, 22,  7, 12, 17, 22,  7, 12, 17, 22,  7, 12, 17, 22,
  5,  9, 14, 20,  5,  9, 14, 20,  5,  9, 14, 20,  5,  9, 14, 20,
  4, 11, 16, 23,  4, 11, 16, 23,  4, 11, 16, 23,  4, 11, 16, 23,
  6, 10, 15, 21,  6, 10, 15, 21,  6, 10, 15, 21,  6, 10, 15, 21
}

Number of bit rotations per round according to the MD5 algorithm.

Definition at line 98 of file MD5Sum.h.

The number of digested bits.

Definition at line 114 of file MD5Sum.h.

Initial value:
 {
  0x00000080, 0x00000000, 0x00000000, 0x00000000,
  0x00000000, 0x00000000, 0x00000000, 0x00000000,
  0x00000000, 0x00000000, 0x00000000, 0x00000000,
  0x00000000, 0x00000000, 0x00000000, 0x00000000
}

Padding required to fill the last MD5 block for finalization.

Definition at line 106 of file MD5Sum.h.


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


variant_topic_tools
Author(s): Ralf Kaestner
autogenerated on Fri Aug 5 2016 06:06:27