CMS 3D CMS Logo

List of all members | Public Member Functions | Public Attributes
cms::MD5Result Struct Reference

#include <Digest.h>

Public Member Functions

std::string compactForm () const
 
void fromHexifiedString (std::string const &s)
 
bool isValid () const
 
 MD5Result ()
 
std::string toString () const
 

Public Attributes

unsigned char bytes [16]
 

Detailed Description

Definition at line 11 of file Digest.h.

Constructor & Destructor Documentation

◆ MD5Result()

cms::MD5Result::MD5Result ( )

Definition at line 75 of file Digest.cc.

References cms::set_to_default().

75 { set_to_default(*this); }
void set_to_default(MD5Result &val)
Definition: Digest.cc:56

Member Function Documentation

◆ compactForm()

std::string cms::MD5Result::compactForm ( ) const

Definition at line 109 of file Digest.cc.

References bytes, AlCaHLTBitMon_ParallelJobs::p, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by edm::detail::InvalidHash().

109  {
110  // This is somewhat dangerous, because the conversion of 'unsigned
111  // char' to 'char' may be undefined if 'char' is a signed type
112  // (4.7p3 in the Standard).
113  const char* p = reinterpret_cast<const char*>(&bytes[0]);
114  return std::string(p, p + sizeof(bytes));
115  }
unsigned char bytes[16]
Definition: Digest.h:18

◆ fromHexifiedString()

void cms::MD5Result::fromHexifiedString ( std::string const &  s)

Definition at line 117 of file Digest.cc.

References bytes, Exception, mps_fire::i, edm::errors::LogicError, and cms::set_to_default().

117  {
118  switch (hexy.size()) {
119  case 0: {
120  set_to_default(*this);
121  } break;
122  case 32: {
123  std::string::const_iterator it = hexy.begin();
124  for (size_t i = 0; i != 16; ++i) {
125  // first nybble
126  bytes[i] = (unhexify(*it++) << 4);
127  // second nybble
128  bytes[i] += (unhexify(*it++));
129  }
130  } break;
131  default: {
132  // Not really sure of what sort of exception to throw...
134  << "String of illegal length: " << hexy.size() << " given to MD5Result::fromHexifiedString";
135  }
136  }
137  }
unsigned char bytes[16]
Definition: Digest.h:18
void set_to_default(MD5Result &val)
Definition: Digest.cc:56

◆ isValid()

bool cms::MD5Result::isValid ( void  ) const

Definition at line 139 of file Digest.cc.

Referenced by ntupleDataFormat._Object::_checkIsValid(), and core.AutoHandle.AutoHandle::ReallyLoad().

139 { return (*this != invalidResult()); }

◆ toString()

std::string cms::MD5Result::toString ( ) const

Member Data Documentation

◆ bytes

unsigned char cms::MD5Result::bytes[16]

Definition at line 18 of file Digest.h.

Referenced by compactForm(), cms::Digest::digest(), fromHexifiedString(), and toString().