CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 13 of file Digest.h.

Constructor & Destructor Documentation

cms::MD5Result::MD5Result ( )

Definition at line 64 of file Digest.cc.

References cms::set_to_default().

65  {
66  set_to_default(*this);
67  }
void set_to_default(MD5Result &val)
Definition: Digest.cc:44

Member Function Documentation

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

Definition at line 102 of file Digest.cc.

References bytes, and AlCaHLTBitMon_ParallelJobs::p.

Referenced by edm::hash_detail::fixup_(), and edm::detail::InvalidHash().

103  {
104  // This is somewhat dangerous, because the conversion of 'unsigned
105  // char' to 'char' may be undefined if 'char' is a signed type
106  // (4.7p3 in the Standard).
107  const char* p = reinterpret_cast<const char*>(&bytes[0]);
108  return std::string(p, p+sizeof(bytes));
109  }
unsigned char bytes[16]
Definition: Digest.h:21
void cms::MD5Result::fromHexifiedString ( std::string const &  s)

Definition at line 111 of file Digest.cc.

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

Referenced by edm::hash_detail::fixup_().

112  {
113  switch (hexy.size())
114  {
115  case 0:
116  {
117  set_to_default(*this);
118  }
119  break;
120  case 32:
121  {
122  std::string::const_iterator it = hexy.begin();
123  for (size_t i = 0; i != 16; ++i)
124  {
125  // first nybble
126  bytes[i] = ( unhexify(*it++) << 4 );
127  // second nybble
128  bytes[i] += ( unhexify(*it++) );
129  }
130  }
131  break;
132  default:
133  {
134  // Not really sure of what sort of exception to throw...
136  << "String of illegal length: "
137  << hexy.size()
138  << " given to MD5Result::fromHexifiedString";
139  }
140  }
141  }
int i
Definition: DBlmapReader.cc:9
unsigned char bytes[16]
Definition: Digest.h:21
void set_to_default(MD5Result &val)
Definition: Digest.cc:44
bool cms::MD5Result::isValid ( void  ) const

Definition at line 143 of file Digest.cc.

144  {
145  return (*this != invalidResult());
146  }
std::string cms::MD5Result::toString ( ) const

Definition at line 87 of file Digest.cc.

References bytes, i, AlCaHLTBitMon_ParallelJobs::p, and cms::s_hexValues.

Referenced by edm::ParameterSet::calculateID(), dumpInitHeader(), edm::ProcessConfiguration::id(), edm::Parentage::id(), edm::EventEntryDescription::id(), edm::ProcessHistory::id(), DQMRootOutputModule::openFile(), cms::operator<<(), edm::hash_detail::print_(), edm::RootOutputFile::RootOutputFile(), DQMRootSource::setupFile(), edm::hash_detail::toDigest_(), and edm::hash_detail::toString_().

88  {
89  char buf[16*2];
90  char* pBuf=buf;
91  for(unsigned int i=0; i<sizeof(bytes);++i){
92  const char* p = s_hexValues+2*bytes[i];
93  *pBuf = *p;
94  ++pBuf;
95  ++p;
96  *pBuf=*p;
97  ++pBuf;
98  }
99  return std::string(buf, sizeof(buf));
100  }
int i
Definition: DBlmapReader.cc:9
unsigned char bytes[16]
Definition: Digest.h:21
static const char * s_hexValues
Definition: Digest.cc:69

Member Data Documentation

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