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.

75 { set_to_default(*this); }

References cms::set_to_default().

Member Function Documentation

◆ compactForm()

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

Definition at line 109 of file Digest.cc.

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  }

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

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

◆ fromHexifiedString()

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

Definition at line 117 of file Digest.cc.

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  }

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

◆ isValid()

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

Definition at line 139 of file Digest.cc.

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

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

◆ toString()

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

Definition at line 95 of file Digest.cc.

95  {
96  char buf[16 * 2];
97  char* pBuf = buf;
98  for (unsigned int i = 0; i < sizeof(bytes); ++i) {
99  const char* p = s_hexValues + 2 * bytes[i];
100  *pBuf = *p;
101  ++pBuf;
102  ++p;
103  *pBuf = *p;
104  ++pBuf;
105  }
106  return std::string(buf, sizeof(buf));
107  }

References visDQMUpload::buf, bytes, mps_fire::i, AlCaHLTBitMon_ParallelJobs::p, cms::s_hexValues, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by edm::ParameterSet::calculateID(), edm::ParameterSet::emptyParameterSetID(), edm::ProcessConfiguration::id(), edm::EventEntryDescription::id(), edm::Parentage::id(), edm::ProcessHistory::id(), NanoAODOutputModule::openFile(), DQMRootOutputModule::openFile(), edm::ParameterSet::registerFromString(), and edm::RootOutputFile::RootOutputFile().

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().

mps_fire.i
i
Definition: mps_fire.py:428
edm::errors::LogicError
Definition: EDMException.h:37
AlCaHLTBitMon_ParallelJobs.p
p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
cms::s_hexValues
static const char * s_hexValues
Definition: Digest.cc:77
cms::MD5Result::bytes
unsigned char bytes[16]
Definition: Digest.h:18
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
cms::set_to_default
void set_to_default(MD5Result &val)
Definition: Digest.cc:56
visDQMUpload.buf
buf
Definition: visDQMUpload.py:154
Exception
Definition: hltDiff.cc:245