Go to the documentation of this file.
37 static const char hexChars[] =
"0123456789abcdef";
66 else if (!isxdigit(
c))
69 <<
"Illegal hex digit: '" <<
c <<
"'"
104 for (
const auto& byteVal : dig_)
123 buf.resize(1 + 2*dig_.size());
128 buf.resize(2*dig_.size());
131 for (
const auto& byteVal : dig_)
133 buf[nChar++] =
hexChars[((byteVal >> 4) & 0xF)];
134 buf[nChar++] =
hexChars[(byteVal & 0xF)];
143 for (
auto& byteVal : dig_)
148 byteVal = (upp << 4) + low;
163 for (
const auto& byteVal : dig_)
178 return (dig_ == rhs.dig_);
185 if (hexdigits.empty())
192 if (hexdigits[0] ==
'_')
198 if (hexdigits.size() != nChar + 2*dig_.size())
203 for (
const auto& byteVal : dig_)
205 const char upp =
hexChars[((byteVal >> 4) & 0xF)];
206 const char low =
hexChars[(byteVal & 0xF)];
208 if (upp != hexdigits[nChar++])
return false;
209 if (low != hexdigits[nChar++])
return false;
219 if (!hexdigits || !*hexdigits)
226 if (hexdigits[0] ==
'_')
232 if (strlen(hexdigits) != nChar + 2*dig_.size())
237 for (
const auto& byteVal : dig_)
239 const char upp =
hexChars[((byteVal >> 4) & 0xF)];
240 const char low =
hexChars[(byteVal & 0xF)];
242 if (upp != hexdigits[nChar++])
return false;
243 if (low != hexdigits[nChar++])
return false;
278 return dig.
write(os);
Useful combination of include files which define Sin, Sout and Serr and the use of IO streams general...
SHA1Digest()
Construct a zero digest.
bool operator==(const SHA1Digest &) const
Equality operator.
bool read(const char *buf, int32_t &val)
Same as readInt32.
void clear()
Reset the digest to zero.
Istream & operator>>(Istream &, directionInfo &)
static const char hexChars[]
static const SHA1Digest null
A null digest (ie, all zero)
bool empty() const
Return true if the digest is empty (ie, all zero).
Ostream & operator<<(Ostream &, const boundaryPatch &p)
Write boundaryPatch as dictionary entries (without surrounding braces)
Ostream & write(Ostream &os, const bool prefixed=false) const
Write (40-byte) text representation, optionally with '_' prefix.
tmp< faMatrix< Type > > operator==(const faMatrix< Type > &, const faMatrix< Type > &)
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
static constexpr int offsetZero
static unsigned char readHexDigit(Istream &is)
virtual bool check(const char *operation) const
Check IOstream status for given operation.
static constexpr int offsetUpper
virtual bool write(const token &tok)=0
Write token to stream or otherwise handle it.
errorManipArg< error, int > exit(error &err, const int errNo=1)
bool operator!=(const SHA1Digest &) const
Inequality operator.
const dimensionedScalar c
Speed of light in a vacuum.
#define FatalIOErrorInFunction(ios)
Report an error message using Foam::FatalIOError.
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Istream & read(Istream &is)
Read (40-byte) text representation.
std::string str(const bool prefixed=false) const
Return (40-byte) text representation, optionally with '_' prefix.
virtual Istream & read(token &)=0
Return next token from stream.