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

std::array< unsigned char, 16 > bytes
 

Detailed Description

Definition at line 12 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.data());
114  return std::string(p, p + bytes.size());
115  }
std::array< unsigned char, 16 > bytes
Definition: Digest.h:19

◆ fromHexifiedString()

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

Definition at line 117 of file Digest.cc.

References bytes, Exception, mps_fire::i, ALPAKA_ACCELERATOR_NAMESPACE::vertexFinder::it, 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  }
void set_to_default(MD5Result &val)
Definition: Digest.cc:56
std::array< unsigned char, 16 > bytes
Definition: Digest.h:19

◆ 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

Definition at line 95 of file Digest.cc.

References b, visDQMUpload::buf, bytes, 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(), NanoAODRNTupleOutputModule::openFile(), NanoAODOutputModule::openFile(), DQMRootOutputModule::openFile(), edm::ParameterSet::registerFromString(), and edm::RootOutputFile::RootOutputFile().

95  {
96  std::array<char, 16 * 2> buf;
97  char* pBuf = buf.begin();
98  for (auto b : bytes) {
99  const char* p = s_hexValues + 2 * b;
100  *pBuf = *p;
101  ++pBuf;
102  ++p;
103  *pBuf = *p;
104  ++pBuf;
105  }
106  return std::string(buf.begin(), buf.end());
107  }
std::array< unsigned char, 16 > bytes
Definition: Digest.h:19
static const char * s_hexValues
Definition: Digest.cc:77
double b
Definition: hdecay.h:120

Member Data Documentation

◆ bytes

std::array<unsigned char, 16> cms::MD5Result::bytes

Definition at line 19 of file Digest.h.

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