41 #ifndef Foam_SHA1Digest_H 42 #define Foam_SHA1Digest_H 67 std::array<unsigned char, 20> dig_;
76 unsigned char* data()
noexcept {
return dig_.data(); }
98 SHA1Digest(
const char* content, std::size_t len);
103 SHA1Digest(
const unsigned char* content, std::size_t len);
115 std::string
str(
const bool prefixed=
false)
const;
130 const unsigned char*
cdata() const
noexcept {
return dig_.data(); }
136 return reinterpret_cast<const char*
>(dig_.data());
144 return reinterpret_cast<char*
>(dig_.data());
163 bool operator==(
const std::string& hexdigits)
const;
175 return !(*
this == rhs);
179 bool operator!=(
const std::string& hexdigits)
const 181 return !(*
this == hexdigits);
187 return !(*
this == hexdigits);
197 Istream&
operator>>(Istream& is, SHA1Digest& dig);
200 Ostream&
operator<<(Ostream&
os,
const SHA1Digest& dig);
206 template<>
struct is_contiguous<SHA1Digest> : std::true_type {};
char * data_bytes() noexcept
Raw digest char data (20 bytes) - non-const access. For consistency with other objects, these are not unsigned. Use with caution - generally for broadcasting only.
An Istream is an abstract base class for all input systems (streams, files, token lists etc)...
bool operator!=(const SHA1Digest &rhs) const
Inequality operator.
const char * cdata_bytes() const noexcept
Raw digest char data (20 bytes) - const access. For consistency with other objects, these are not unsigned.
Istream & operator>>(Istream &, directionInfo &)
SHA1Digest()
Default construct a zero digest.
const unsigned char * cdata() const noexcept
Raw digest data (20 bytes) - const access.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
bool empty() const
Return true if the digest is empty (ie, all zero).
OBJstream os(runTime.globalPath()/outputName)
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.
void clear()
Reset the digest to zero.
bool operator==(const SHA1Digest &rhs) const
Equality operator.
static constexpr unsigned max_size() noexcept
The dimensioned size of the digest is always 20 bytes.
std::string str(const bool prefixed=false) const
Return (40-byte) text representation, optionally with '_' prefix.
static constexpr unsigned size_bytes() noexcept
The number of bytes in digest (20)
Functions to compute SHA1 message digest according to the NIST specification FIPS-180-1.
Istream & read(Istream &is)
Read (40-byte) text representation.
static const SHA1Digest null
A null digest (ie, all zero)