SLBM  3.0
Regional Seismic Travel Time
Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | List of all members
util::MD50 Class Reference

This code implements the MD5 message-digest algorithm. The algorithm is due to Ron Rivest. This code was written by Colin Plumb in 1993, no copyright is claimed. This code is in the public domain; do with it what you wish. More...

#include <MD50.h>

Public Member Functions

 MD50 ()
 
 MD50 (const MD50 &md50)
 
virtual ~MD50 ()
 
MD50operator= (const MD50 &md50)
 
const string & getMD5HashHex (uchar const *data, int sze)
 Given an input data array and size sze, this function creates a 32 byte hexadecimal MD5 hash key from the data and returns the result as a string. No checking is performed on the size of the input array data. More...
 
void getMD5HashHex (uchar const *data, int sze, string &hhstr)
 
void getMD5HashHex (const string &sin, string &hhstr)
 Given an input data array and size sze, this function creates a 32 byte hexadecimal MD5 hash key from the data and returns the result in hhstr. No checking is performed on the size of the input array data. More...
 
const string & getMD5HashHex () const
 
void getMD5HashHex (string &s) const
 
cuchar const * getMD5HashBin (uchar const *data, int sze)
 Given an input data array and size sze, this function creates an MD5 hash key from the data and stores the 16 byte binary key in the attribute array hashkey. No checking is performed on the size of the array data. More...
 
cuchar const * getMD5HashBin ()
 Returns the 16 byte binary hash key. This function assumes that the MD5 conversion has already been performed. More...
 
void setDefaultEndian ()
 Sets the big endian flag to br. More...
 
void setBigEndian ()
 Sets the big endian flag to true. More...
 
void setLittleEndian ()
 Sets the big endian flag to false. More...
 
bool getByteReverse () const
 Returns the big endian flag setting. More...
 

Static Public Member Functions

static int hexStringSize ()
 Returns the hexadecimal size of an MD5 hash key. More...
 
static int hexSize ()
 Returns the hexadecimal size of an MD5 hash key. More...
 
static int binSize ()
 Returns the binary size of an MD5 hash key. More...
 
static bool isBigEndian ()
 

Private Member Functions

void init ()
 
void update (uchar const *data, unsigned len)
 
void final ()
 
void transform ()
 
void byteReverse (uchar *buf, unsigned n)
 

Private Attributes

bool md5BigEndian
 If true byte reversal occurs (Big-Endian). More...
 
uint32 md5BinKey [4]
 The 16 byte buffer that contains hash key after calling getMD5HashBin. More...
 
uint32 md5Bits [2]
 Used by md5 for padding operations. More...
 
uchar md5Buf [64]
 The temporary buffer that contains 64 bytes of the string for which the key is generated. These 64 bytes are processed to modify the values in md5BinKey. The entire input string is processed 64 bytes at a time through this buffer. More...
 
uint32 const * md5BufRef
 A recast reference to md5Buf that is used in the function transform() to perform the core MD5 algorithmic transformation. More...
 

Detailed Description

The MD5 code was converted to an MD5 C++ object (MD50) by Jim Hipp, Sandia National Laboratories, in May of 2004. The code was modified Specifically for the PGL library and optimized to replace all "define" definitions with equivalent inlined function objects. The machine dependent byte reversal flag is called automatically at object construction to turn byte-reversal ON (big-endian) or OFF (little-endian). The flag can be manually set to either-endian format with the functions setBigEndian() or setLittleEndian().

The 32 byte hexadecimal string message digest is computed with any of the functions getMD5HashHex(...). The equivalent 16 byte binary message digest is returned with the functions getMD5BinHex(...).

Constructor & Destructor Documentation

util::MD50::MD50 ( )
util::MD50::MD50 ( const MD50 md50)
virtual util::MD50::~MD50 ( )
virtual

Member Function Documentation

int util::MD50::binSize ( )
inlinestatic
void util::MD50::byteReverse ( uchar buf,
unsigned  n 
)
private
void util::MD50::final ( )
private
bool util::MD50::getByteReverse ( ) const
inline
cuchar const * util::MD50::getMD5HashBin ( uchar const *  data,
int  sze 
)
inline
cuchar const * util::MD50::getMD5HashBin ( )
inline
const string & util::MD50::getMD5HashHex ( uchar const *  data,
int  sze 
)
inline
void util::MD50::getMD5HashHex ( uchar const *  data,
int  sze,
string &  hhstr 
)
inline
void util::MD50::getMD5HashHex ( const string &  sin,
string &  hhstr 
)
inline

Given an input string sin, this function creates a 32 byte hexadecimal MD5 hash key from the strings data and returns the result in hhstr.

const string& util::MD50::getMD5HashHex ( ) const
void util::MD50::getMD5HashHex ( string &  s) const
int util::MD50::hexSize ( )
inlinestatic
int util::MD50::hexStringSize ( )
inlinestatic
void util::MD50::init ( )
private
static bool util::MD50::isBigEndian ( )
static
MD50& util::MD50::operator= ( const MD50 md50)
void util::MD50::setBigEndian ( )
inline
void util::MD50::setDefaultEndian ( )
inline
void util::MD50::setLittleEndian ( )
inline
void util::MD50::transform ( )
private
void util::MD50::update ( uchar const *  data,
unsigned  len 
)
private

Member Data Documentation

bool util::MD50::md5BigEndian
private
uint32 util::MD50::md5BinKey[4]
private
uint32 util::MD50::md5Bits[2]
private
uchar util::MD50::md5Buf[64]
private
uint32 const* util::MD50::md5BufRef
private

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