Crypto++
5.6.3
Free C++ class library of cryptographic schemes
|
Public Member Functions | |
SHA3 (unsigned int digestSize) | |
unsigned int | DigestSize () const |
Provides the digest size of the hash. More... | |
std::string | AlgorithmName () const |
Provides the name of this algorithm. More... | |
unsigned int | OptimalDataAlignment () const |
Provides input and output data alignment for optimal performance. More... | |
void | Update (const byte *input, size_t length) |
Updates a hash with additional input. More... | |
void | Restart () |
Restart the hash. More... | |
void | TruncatedFinal (byte *hash, size_t size) |
Computes the hash of the current message. More... | |
HashTransformation & | Ref () |
Provides a reference to this object. More... | |
virtual byte * | CreateUpdateSpace (size_t &size) |
Request space which can be written into by the caller. More... | |
virtual void | Final (byte *digest) |
Computes the hash of the current message. More... | |
unsigned int | TagSize () const |
Provides the tag size of the hash. More... | |
virtual unsigned int | BlockSize () const |
Provides the block size of the compression function. More... | |
virtual unsigned int | OptimalBlockSize () const |
Provides the input block size most efficient for this hash. More... | |
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. More... | |
virtual bool | Verify (const byte *digest) |
Verifies the hash of the current message. More... | |
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. More... | |
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. More... | |
virtual bool | TruncatedVerify (const byte *digest, size_t digestLength) |
Verifies the hash of the current message. More... | |
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. More... | |
virtual Clonable * | Clone () const |
Copies this object. More... | |
|
inlinevirtual |
Provides the digest size of the hash.
Calls to Final() require a buffer that is equal to (or greater than) DigestSize().
Implements HashTransformation.
|
inlinevirtual |
Provides the name of this algorithm.
The standard algorithm name can be a name like AES or AES/GCM. Some algorithms do not have standard names yet. For example, there is no standard algorithm name for Shoup's ECIES.
Reimplemented from Algorithm.
Definition at line 21 of file sha3.h.
References IntToString().
|
inlinevirtual |
Provides input and output data alignment for optimal performance.
Reimplemented from HashTransformation.
|
virtual |
Updates a hash with additional input.
input | the additional input as a buffer |
length | the size of the buffer, in bytes |
Implements HashTransformation.
Definition at line 252 of file sha3.cpp.
References SecBlock< T, A >::BytePtr(), and xorbuf().
|
virtual |
Restart the hash.
Discards the current state, and restart for a new message
Reimplemented from HashTransformation.
Definition at line 274 of file sha3.cpp.
References SecBlock< T, A >::SizeInBytes().
Referenced by TruncatedFinal().
|
virtual |
Computes the hash of the current message.
digest | a pointer to the buffer to receive the hash |
digestSize | the size of the truncated digest, in bytes |
TruncatedFinal() call Final() and then copies digestSize bytes to digest
TruncatedFinal() restarts the hash for the next nmessage.
Implements HashTransformation.
Definition at line 280 of file sha3.cpp.
References SecBlock< T, A >::BytePtr(), and Restart().
|
inlineinherited |
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.
|
inlinevirtualinherited |
Request space which can be written into by the caller.
size | the requested size of the buffer |
The purpose of this method is to help avoid extra memory allocations.
size is an IN and OUT parameter and used as a hint. When the call is made, size is the requested size of the buffer. When the call returns, size is the size of the array returned to the caller.
The base class implementation sets size to 0 and returns NULL.
Definition at line 879 of file cryptlib.h.
|
inlinevirtualinherited |
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 Name::DigestSize().
Referenced by DefaultDecryptor::DefaultDecryptor(), DefaultEncryptor::DefaultEncryptor(), PKCS5_PBKDF2_HMAC< T >::DeriveKey(), RandomPool::IncorporateEntropy(), PKCS_EncryptionPaddingScheme::MaxUnpaddedLength(), and HMAC_Base::TruncatedFinal().
|
inlineinherited |
Provides the tag size of the hash.
Same as DigestSize().
Definition at line 901 of file cryptlib.h.
References Name::DigestSize().
|
inlinevirtualinherited |
Provides the block size of the compression function.
BlockSize() will return 0 if the hash is not block based. For example, SHA3 is a recursive hash (not an iterative hash), and it does not have a block size.
Reimplemented in VMAC_Base, and Weak::MD2.
Definition at line 907 of file cryptlib.h.
Referenced by CBC_MAC_Base::DigestSize(), HMAC_Base::DigestSize(), HMAC_Base::TruncatedFinal(), CBC_MAC_Base::TruncatedFinal(), and HMAC_Base::UncheckedSetKey().
|
inlinevirtualinherited |
Provides the input block size most efficient for this hash.
The base class implemnetation returns MandatoryBlockSize().
n * OptimalBlockSize() - GetOptimalBlockSizeUsed()
for any n > 0
. Reimplemented in CMAC_Base, and HMAC_Base.
Definition at line 914 of file cryptlib.h.
|
inlinevirtualinherited |
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 HKDF< T >::DeriveKey(), PKCS5_PBKDF2_HMAC< T >::DeriveKey(), and OAEP_Base::MaxUnpaddedLength().
|
inlinevirtualinherited |
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 Name::DigestSize().
Referenced by Gunzip::Gunzip(), and ZlibDecompressor::ZlibDecompressor().
|
inlinevirtualinherited |
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.
Referenced by OAEP_Base::MaxUnpaddedLength().
|
inlinevirtualinherited |
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.
|
virtualinherited |
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 TruncatedHashTemplate< T >, and NullHash.
Definition at line 411 of file cryptlib.cpp.
References Name::DigestSize(), IntToString(), and VerifyBufsEqual().
|
inlinevirtualinherited |
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.
|
inlinevirtualinherited |
Copies this object.
NotImplemented |
Definition at line 464 of file cryptlib.h.