The SHA1 message digest. More...
#include <SHA1Digest.H>

Public Member Functions | |
| SHA1Digest () | |
| Default construct a zero digest. | |
| SHA1Digest (Istream &is) | |
| Read construct a digest from stringified content. | |
| SHA1Digest (const char *content, std::size_t len) | |
| Construct digest from raw or stringified content. The length is 20 for raw digest content and 40 (or 41) for stringified versions. | |
| SHA1Digest (const unsigned char *content, std::size_t len) | |
| Construct digest from raw or stringified content. The length is 20 for raw digest content and 40 (or 41) for stringified versions. | |
| void | clear () |
| Reset the digest to zero. | |
| bool | empty () const |
| Return true if the digest is empty (ie, all zero). | |
| std::string | str (const bool prefixed=false) const |
| Return (40-byte) text representation, optionally with '_' prefix. | |
| Istream & | read (Istream &is) |
| Read (40-byte) text representation. | |
| Ostream & | write (Ostream &os, const bool prefixed=false) const |
| Write (40-byte) text representation, optionally with '_' prefix. | |
| const unsigned char * | cdata () const noexcept |
| Raw digest data (20 bytes) - const access. | |
| const char * | cdata_bytes () const noexcept |
| Raw digest char data (20 bytes) - const access. For consistency with other objects, these are not unsigned. | |
| 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. | |
| bool | operator== (const SHA1Digest &rhs) const |
| Equality operator. | |
| bool | operator== (const std::string &hexdigits) const |
| Compare to (40-byte) text representation (eg, from sha1sum). | |
| bool | operator== (const char *hexdigits) const |
| Compare to (40-byte) text representation (eg, from sha1sum). | |
| bool | operator!= (const SHA1Digest &rhs) const |
| Inequality operator. | |
| bool | operator!= (const std::string &hexdigits) const |
| Inequality operator. | |
| bool | operator!= (const char *hexdigits) const |
| Inequality operator. | |
Static Public Member Functions | |
| static constexpr unsigned | size_bytes () noexcept |
| The number of bytes in digest (20). | |
| static constexpr unsigned | max_size () noexcept |
| The dimensioned size of the digest is always 20 bytes. | |
Static Public Attributes | |
| static const SHA1Digest | null |
| A null digest (ie, all zero). | |
Friends | |
| class | SHA1 |
The SHA1 message digest.
Definition at line 57 of file SHA1Digest.H.
| SHA1Digest | ( | ) |
Default construct a zero digest.
Definition at line 158 of file SHA1Digest.C.
Referenced by operator!=(), and operator==().

|
explicit |
Read construct a digest from stringified content.
Definition at line 178 of file SHA1Digest.C.
References Foam::read().

| SHA1Digest | ( | const char * | content, |
| std::size_t | len ) |
Construct digest from raw or stringified content. The length is 20 for raw digest content and 40 (or 41) for stringified versions.
Definition at line 164 of file SHA1Digest.C.
| SHA1Digest | ( | const unsigned char * | content, |
| std::size_t | len ) |
Construct digest from raw or stringified content. The length is 20 for raw digest content and 40 (or 41) for stringified versions.
Definition at line 171 of file SHA1Digest.C.
| void clear | ( | ) |
Reset the digest to zero.
Definition at line 187 of file SHA1Digest.C.
| bool empty | ( | ) | const |
Return true if the digest is empty (ie, all zero).
Definition at line 193 of file SHA1Digest.C.
Referenced by operator==(), and operator==().

| std::string str | ( | const bool | prefixed = false | ) | const |
Return (40-byte) text representation, optionally with '_' prefix.
Definition at line 222 of file SHA1Digest.C.
References hexChars.
| Foam::Istream & read | ( | Istream & | is | ) |
Read (40-byte) text representation.
Since leading and intermediate underscores are skipped, a '_' can be prefixed to the text representation to use an unquoted SHA1Digest without parsing ambiguities as a number.
Definition at line 207 of file SHA1Digest.C.
References IOstream::check(), FUNCTION_NAME, and Foam::readHexDigit().
Referenced by Foam::operator>>().


| Foam::Ostream & write | ( | Ostream & | os, |
| const bool | prefixed = false ) const |
Write (40-byte) text representation, optionally with '_' prefix.
Definition at line 247 of file SHA1Digest.C.
References FUNCTION_NAME, hexChars, and os().
Referenced by Foam::operator<<(), and dynamicCode::writeDigest().


|
inlinenoexcept |
Raw digest data (20 bytes) - const access.
Definition at line 152 of file SHA1Digest.H.
References Foam::noexcept.
|
inlinenoexcept |
Raw digest char data (20 bytes) - const access. For consistency with other objects, these are not unsigned.
Definition at line 158 of file SHA1Digest.H.
References Foam::noexcept.
|
inlinenoexcept |
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.
Definition at line 168 of file SHA1Digest.H.
References Foam::noexcept.
|
inlinestaticconstexprnoexcept |
The number of bytes in digest (20).
Definition at line 176 of file SHA1Digest.H.
References Foam::noexcept.
Referenced by fileOperation::getGlobalHostIORanks().

|
inlinestaticconstexprnoexcept |
The dimensioned size of the digest is always 20 bytes.
Definition at line 181 of file SHA1Digest.H.
References Foam::noexcept.
| bool operator== | ( | const SHA1Digest & | rhs | ) | const |
Equality operator.
Definition at line 267 of file SHA1Digest.C.
References Foam::rhs(), and SHA1Digest().

| bool operator== | ( | const std::string & | hexdigits | ) | const |
Compare to (40-byte) text representation (eg, from sha1sum).
An empty string is equivalent to "0000000000000000000000000000000000000000" The hexdigits may optionally start with a '_' prefix
Definition at line 273 of file SHA1Digest.C.
References empty().

| bool operator== | ( | const char * | hexdigits | ) | const |
Compare to (40-byte) text representation (eg, from sha1sum).
A null or empty string is equivalent to "0000000000000000000000000000000000000000" The hexdigits may optionally start with a '_' prefix
Definition at line 282 of file SHA1Digest.C.
References empty().

|
inline |
Inequality operator.
Definition at line 213 of file SHA1Digest.H.
References Foam::rhs(), and SHA1Digest().

|
inline |
Inequality operator.
Definition at line 221 of file SHA1Digest.H.
|
inline |
Inequality operator.
Definition at line 229 of file SHA1Digest.H.
|
friend |
Definition at line 70 of file SHA1Digest.H.
References Foam::noexcept, and SHA1.
Referenced by SHA1.
|
static |
A null digest (ie, all zero).
Definition at line 85 of file SHA1Digest.H.