| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

In This Package:

Gaudi::Math::MD5 Class Reference

#include <MD5.h>

List of all members.


Public Types

typedef boost::uint8_t value_type [16]

Public Member Functions

 MD5 ()
 create an (recognizable!) invalid digest...
std::string str () const
 provide a hex string representation of the (internal) 128 bit value of the computed digest
bool invalid () const
 check whether the digest is the (valid) result of an MD5 computation
bool valid () const
bool operator< (const MD5 &rhs) const
 binary comparisons
bool operator> (const MD5 &rhs) const
bool operator== (const MD5 &rhs) const
bool operator<= (const MD5 &rhs) const
bool operator>= (const MD5 &rhs) const
bool operator!= (const MD5 &rhs) const

Static Public Member Functions

static MD5 createInvalid ()
static MD5 compute (const std::string &s)
 compute MD5 digest for the specified string
template<typename T>
static MD5 compute (const T &t)
 compute MD5 digest for the provided object by first streaming it to a string
static MD5 createFromStringRep (const std::string &s)
 convert the hex string representation back to a full-blown instance

Private Member Functions

 MD5 (const value_type &val)

Private Attributes

value_type m_value

Classes

class  md5_engine

Detailed Description

Definition at line 21 of file MD5.h.


Member Typedef Documentation

typedef boost::uint8_t Gaudi::Math::MD5::value_type[16]

Definition at line 23 of file MD5.h.


Constructor & Destructor Documentation

Gaudi::Math::MD5::MD5 (  )  [inline]

create an (recognizable!) invalid digest...

Definition at line 28 of file MD5.h.

00028 { memset(m_value,0u,sizeof(m_value)); }

Gaudi::Math::MD5::MD5 ( const value_type val  )  [inline, explicit, private]

Definition at line 64 of file MD5.h.

00064 { memcpy(m_value,val,sizeof(m_value)); }


Member Function Documentation

static MD5 Gaudi::Math::MD5::createInvalid (  )  [inline, static]

Definition at line 29 of file MD5.h.

00029 {  return MD5(); }

static MD5 Gaudi::Math::MD5::compute ( const std::string &  s  )  [static]

compute MD5 digest for the specified string

template<typename T>
static MD5 Gaudi::Math::MD5::compute ( const T &  t  )  [inline, static]

compute MD5 digest for the provided object by first streaming it to a string

Definition at line 35 of file MD5.h.

00036            { std::ostringstream x; x << t; return compute(x.str()); }

string Gaudi::Math::MD5::str (  )  const

provide a hex string representation of the (internal) 128 bit value of the computed digest

Definition at line 72 of file MD5.cpp.

00072                         {
00073     string s; s.reserve(2*sizeof(value_type));
00074     for (const boost::uint8_t* i = m_value; i!=m_value+sizeof(value_type); ++i) {
00075         static const char *digits="0123456789abcdef";
00076         s+=digits[(*i>>4)&0x0F]; s+=digits[(*i)&0x0F];
00077     }
00078     return s;
00079 }

Gaudi::Math::MD5 Gaudi::Math::MD5::createFromStringRep ( const std::string &  s  )  [static]

convert the hex string representation back to a full-blown instance

Definition at line 93 of file MD5.cpp.

00093                                                       { 
00094     assert(val.size()==2*sizeof(Gaudi::Math::MD5::value_type) || val.empty());
00095     if (val.empty()) return createInvalid();
00096     Gaudi::Math::MD5::value_type d;
00097     for (size_t i=0;i<sizeof(d);++i) d[i]=(unhex(val[2*i])<<4|unhex(val[2*i+1]));
00098     return MD5(d);
00099 };

bool Gaudi::Math::MD5::invalid (  )  const [inline]

check whether the digest is the (valid) result of an MD5 computation

Definition at line 45 of file MD5.h.

00046            { value_type x; 
00047              return memcmp(m_value,memset(x,0u,sizeof(x)),sizeof(m_value))==0; 
00048            }

bool Gaudi::Math::MD5::valid (  )  const [inline]

Definition at line 49 of file MD5.h.

00049 { return !invalid(); }

bool Gaudi::Math::MD5::operator< ( const MD5 rhs  )  const [inline]

binary comparisons

Definition at line 52 of file MD5.h.

00053            { return memcmp(m_value,rhs.m_value,sizeof(m_value))<0; }

bool Gaudi::Math::MD5::operator> ( const MD5 rhs  )  const [inline]

Definition at line 54 of file MD5.h.

00055            { return memcmp(m_value,rhs.m_value,sizeof(m_value))>0; }

bool Gaudi::Math::MD5::operator== ( const MD5 rhs  )  const [inline]

Definition at line 56 of file MD5.h.

00057            { return memcmp(m_value,rhs.m_value,sizeof(m_value))==0; }

bool Gaudi::Math::MD5::operator<= ( const MD5 rhs  )  const [inline]

Definition at line 59 of file MD5.h.

00059 { return !operator>(rhs); }

bool Gaudi::Math::MD5::operator>= ( const MD5 rhs  )  const [inline]

Definition at line 60 of file MD5.h.

00060 { return !operator<(rhs); }

bool Gaudi::Math::MD5::operator!= ( const MD5 rhs  )  const [inline]

Definition at line 61 of file MD5.h.

00061 { return !operator==(rhs); }


Member Data Documentation

value_type Gaudi::Math::MD5::m_value [private]

Definition at line 66 of file MD5.h.


The documentation for this class was generated from the following files:
| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

Generated on Mon Apr 11 20:02:58 2011 for LHCbMath by doxygen 1.4.7