implements the SHA-512 standard More...
Public Types | |
typedef BigEndian | ByteOrderClass |
typedef word64 | HashWordType |
Public Member Functions | |
unsigned int | DigestSize () const |
Provides the digest size of the hash. | |
Clonable * | Clone () const |
Copies this object. | |
std::string | AlgorithmName () const |
Provides the name of this algorithm. | |
CRYPTOPP_COMPILE_ASSERT ((T_BlockSize &(T_BlockSize-1))==0) | |
unsigned int | BlockSize () const |
Provides the block size of the compression function. | |
ByteOrder | GetByteOrder () const |
unsigned int | OptimalBlockSize () const |
Provides the input block size most efficient for this hash. | |
unsigned int | OptimalDataAlignment () const |
Provides input and output data alignment for optimal performance. | |
void | Update (const byte *input, size_t length) |
Updates a hash with additional input. | |
byte * | CreateUpdateSpace (size_t &size) |
Request space which can be written into by the caller. | |
void | Restart () |
Restart the hash. | |
void | TruncatedFinal (byte *digest, size_t size) |
Computes the hash of the current message. | |
HashTransformation & | Ref () |
Provides a reference to this object. | |
virtual void | Final (byte *digest) |
Computes the hash of the current message. | |
unsigned int | TagSize () const |
Provides the tag size of the hash. | |
virtual void | CalculateDigest (byte *digest, const byte *input, size_t length) |
Updates the hash with additional input and computes the hash of the current message. | |
virtual bool | Verify (const byte *digest) |
Verifies the hash of the current message. | |
virtual bool | VerifyDigest (const byte *digest, const byte *input, size_t length) |
Updates the hash with additional input and verifies the hash of the current message. | |
virtual void | CalculateTruncatedDigest (byte *digest, size_t digestSize, const byte *input, size_t length) |
Updates the hash with additional input and computes the hash of the current message. | |
virtual bool | TruncatedVerify (const byte *digest, size_t digestLength) |
Verifies the hash of the current message. | |
virtual bool | VerifyTruncatedDigest (const byte *digest, size_t digestLength, const byte *input, size_t length) |
Updates the hash with additional input and verifies the hash of the current message. | |
Static Public Member Functions | |
static void | InitState (HashWordType *state) |
static void | Transform (word64 *digest, const word64 *data) |
static const char * | StaticAlgorithmName () |
static void | CorrectEndianess (HashWordType *out, const HashWordType *in, size_t byteCount) |
Static Public Attributes | |
static const int | DIGESTSIZE |
static const int | BLOCKSIZE |
implements the SHA-512 standard
Definition at line 51 of file sha.h.
unsigned int IteratedHashWithStaticTransform< word64 , BigEndian , T_BlockSize, T_StateSize, SHA512 , T_DigestSize, T_StateAligned >::DigestSize | ( | ) | const [inline, virtual, inherited] |
Provides the digest size of the hash.
Calls to Final() require a buffer that is equal to (or greater than) DigestSize().
Implements HashTransformation.
Definition at line 85 of file iterhash.h.
Clonable* ClonableImpl< SHA512 , AlgorithmImpl< IteratedHash< word64, BigEndian, T_BlockSize >, SHA512 > >::Clone | ( | ) | const [inline, virtual, inherited] |
std::string AlgorithmImpl< IteratedHash< word64, BigEndian, T_BlockSize > , SHA512 >::AlgorithmName | ( | ) | const [inline, virtual, inherited] |
unsigned int IteratedHash< word64 , BigEndian , T_BlockSize, HashTransformation >::BlockSize | ( | ) | const [inline, virtual, inherited] |
Reimplemented from HashTransformation.
Definition at line 64 of file iterhash.h.
unsigned int IteratedHashBase< word64 , HashTransformation >::OptimalBlockSize | ( | ) | const [inline, virtual, inherited] |
Reimplemented from HashTransformation.
Definition at line 27 of file iterhash.h.
unsigned int IteratedHashBase< word64 , HashTransformation >::OptimalDataAlignment | ( | ) | const [inline, virtual, inherited] |
Reimplemented from HashTransformation.
Definition at line 28 of file iterhash.h.
void IteratedHashBase< word64 , HashTransformation >::Update | ( | const byte * | input, | |
size_t | length | |||
) | [virtual, inherited] |
Implements HashTransformation.
byte* IteratedHashBase< word64 , HashTransformation >::CreateUpdateSpace | ( | size_t & | size | ) | [virtual, inherited] |
Reimplemented from HashTransformation.
void IteratedHashBase< word64 , HashTransformation >::Restart | ( | ) | [virtual, inherited] |
Reimplemented from HashTransformation.
void IteratedHashBase< word64 , HashTransformation >::TruncatedFinal | ( | byte * | digest, | |
size_t | digestSize | |||
) | [virtual, inherited] |
Implements HashTransformation.
HashTransformation& HashTransformation::Ref | ( | ) | [inline, inherited] |
Provides a reference to this object.
Useful for passing a temporary object to a function that takes a non-const reference
Definition at line 864 of file cryptlib.h.
virtual void HashTransformation::Final | ( | byte * | digest | ) | [inline, virtual, inherited] |
Computes the hash of the current message.
digest | a pointer to the buffer to receive the hash |
digest must be equal to (or greater than) DigestSize(). Final() restarts the hash for a new message.
Definition at line 885 of file cryptlib.h.
References DigestSize().
Referenced by PKCS5_PBKDF2_HMAC< T >::DeriveKey(), RandomPool::IncorporateEntropy(), and HMAC_Base::TruncatedFinal().
unsigned int HashTransformation::TagSize | ( | ) | const [inline, inherited] |
Provides the tag size of the hash.
Same as DigestSize().
Definition at line 901 of file cryptlib.h.
References DigestSize().
virtual void HashTransformation::CalculateDigest | ( | byte * | digest, | |
const byte * | input, | |||
size_t | length | |||
) | [inline, virtual, inherited] |
Updates the hash with additional input and computes the hash of the current message.
digest | a pointer to the buffer to receive the hash | |
input | the additional input as a buffer | |
length | the size of the buffer, in bytes |
Use this if your input is in one piece and you don't want to call Update() and Final() separately
CalculateDigest() restarts the hash for the next nmessage.
Definition at line 927 of file cryptlib.h.
Referenced by PKCS5_PBKDF2_HMAC< T >::DeriveKey(), and HKDF< T >::DeriveKey().
virtual bool HashTransformation::Verify | ( | const byte * | digest | ) | [inline, virtual, inherited] |
Verifies the hash of the current message.
digest | a pointer to the buffer of an existing hash |
true
if the existing hash matches the computed hash, false
otherwise ThrowIfInvalidTruncatedSize() | if the existing hash's size exceeds DigestSize() |
Calls to Verify() require a buffer that is equal to (or greater than) DigestSize().
Verify() performs a bitwise compare on the buffers using VerifyBufsEqual(), which is a constant time comparison function. digestLength cannot exceed DigestSize().
Verify() restarts the hash for the next nmessage.
Definition at line 938 of file cryptlib.h.
References DigestSize().
virtual bool HashTransformation::VerifyDigest | ( | const byte * | digest, | |
const byte * | input, | |||
size_t | length | |||
) | [inline, virtual, inherited] |
Updates the hash with additional input and verifies the hash of the current message.
digest | a pointer to the buffer of an existing hash | |
input | the additional input as a buffer | |
length | the size of the buffer, in bytes |
true
if the existing hash matches the computed hash, false
otherwise ThrowIfInvalidTruncatedSize() | if the existing hash's size exceeds DigestSize() |
Use this if your input is in one piece and you don't want to call Update() and Verify() separately
VerifyDigest() performs a bitwise compare on the buffers using VerifyBufsEqual(), which is a constant time comparison function. digestLength cannot exceed DigestSize().
VerifyDigest() restarts the hash for the next nmessage.
Definition at line 952 of file cryptlib.h.
virtual void HashTransformation::CalculateTruncatedDigest | ( | byte * | digest, | |
size_t | digestSize, | |||
const byte * | input, | |||
size_t | length | |||
) | [inline, virtual, inherited] |
Updates the hash with additional input and computes the hash of the current message.
digest | a pointer to the buffer to receive the hash | |
digestSize | the length of the truncated hash, in bytes | |
input | the additional input as a buffer | |
length | the size of the buffer, in bytes |
Use this if your input is in one piece and you don't want to call Update() and CalculateDigest() separately.
CalculateTruncatedDigest() restarts the hash for the next nmessage.
Definition at line 970 of file cryptlib.h.
bool HashTransformation::TruncatedVerify | ( | const byte * | digest, | |
size_t | digestLength | |||
) | [virtual, inherited] |
Verifies the hash of the current message.
digest | a pointer to the buffer of an existing hash | |
digestLength | the size of the truncated hash, in bytes |
true
if the existing hash matches the computed hash, false
otherwise ThrowIfInvalidTruncatedSize() | if digestLength exceeds DigestSize() |
TruncatedVerify() is a truncated version of Verify(). It can operate on a buffer smaller than DigestSize(). However, digestLength cannot exceed DigestSize().
Verify() performs a bitwise compare on the buffers using VerifyBufsEqual(), which is a constant time comparison function. digestLength cannot exceed DigestSize().
TruncatedVerify() restarts the hash for the next nmessage.
Reimplemented in NullHash, and TruncatedHashTemplate< T >.
Definition at line 411 of file cryptlib.cpp.
References HashTransformation::TruncatedFinal().
Referenced by AuthenticatedSymmetricCipher::DecryptAndVerify().
virtual bool HashTransformation::VerifyTruncatedDigest | ( | const byte * | digest, | |
size_t | digestLength, | |||
const byte * | input, | |||
size_t | length | |||
) | [inline, virtual, inherited] |
Updates the hash with additional input and verifies the hash of the current message.
digest | a pointer to the buffer of an existing hash | |
digestLength | the size of the truncated hash, in bytes | |
input | the additional input as a buffer | |
length | the size of the buffer, in bytes |
true
if the existing hash matches the computed hash, false
otherwise ThrowIfInvalidTruncatedSize() | if digestLength exceeds DigestSize() |
Use this if your input is in one piece and you don't want to call Update() and TruncatedVerify() separately.
VerifyTruncatedDigest() is a truncated version of VerifyDigest(). It can operate on a buffer smaller than DigestSize(). However, digestLength cannot exceed DigestSize().
VerifyTruncatedDigest() restarts the hash for the next nmessage.
Definition at line 997 of file cryptlib.h.