Crypto++  5.6.3
Free C++ class library of cryptographic schemes
Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | List of all members
IteratedHashWithStaticTransform< T_HashWordType, T_Endianness, T_BlockSize, T_StateSize, T_Transform, T_DigestSize, T_StateAligned > Class Template Reference

_ More...

+ Inheritance diagram for IteratedHashWithStaticTransform< T_HashWordType, T_Endianness, T_BlockSize, T_StateSize, T_Transform, T_DigestSize, T_StateAligned >:

Public Types

typedef T_Endianness ByteOrderClass
 
typedef T_HashWordType HashWordType
 

Public Member Functions

unsigned int DigestSize () const
 Provides the digest size of the hash. More...
 
ClonableClone () const
 
std::string AlgorithmName () const
 
unsigned int BlockSize () const
 
ByteOrder GetByteOrder () const
 
unsigned int OptimalBlockSize () const
 
unsigned int OptimalDataAlignment () const
 
void Update (const byte *input, size_t length)
 
byte * CreateUpdateSpace (size_t &size)
 
void Restart ()
 
void TruncatedFinal (byte *digest, size_t size)
 
HashTransformationRef ()
 Provides a reference to this object. 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 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...
 

Static Public Member Functions

static std::string StaticAlgorithmName ()
 
static void CorrectEndianess (HashWordType *out, const HashWordType *in, size_t byteCount)
 

Static Public Attributes

static const int DIGESTSIZE = T_DigestSize ? T_DigestSize : T_StateSize
 
static const int BLOCKSIZE
 

Detailed Description

template<class T_HashWordType, class T_Endianness, unsigned int T_BlockSize, unsigned int T_StateSize, class T_Transform, unsigned int T_DigestSize = 0, bool T_StateAligned = false>
class IteratedHashWithStaticTransform< T_HashWordType, T_Endianness, T_BlockSize, T_StateSize, T_Transform, T_DigestSize, T_StateAligned >

_

Definition at line 80 of file iterhash.h.

Member Function Documentation

template<class T_HashWordType, class T_Endianness, unsigned int T_BlockSize, unsigned int T_StateSize, class T_Transform, unsigned int T_DigestSize = 0, bool T_StateAligned = false>
unsigned int IteratedHashWithStaticTransform< T_HashWordType, T_Endianness, T_BlockSize, T_StateSize, T_Transform, T_DigestSize, T_StateAligned >::DigestSize ( ) const
inlinevirtual

Provides the digest size of the hash.

Returns
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.

Referenced by AutoSeededX917RNG< BLOCK_CIPHER >::Reseed().

HashTransformation& HashTransformation::Ref ( )
inlineinherited

Provides a reference to this object.

Returns
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)
inlinevirtualinherited

Computes the hash of the current message.

Parameters
digesta 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().

unsigned int HashTransformation::TagSize ( ) const
inlineinherited

Provides the tag size of the hash.

Returns
the tag size of the hash.

Same as DigestSize().

Definition at line 901 of file cryptlib.h.

References Name::DigestSize().

virtual void HashTransformation::CalculateDigest ( byte *  digest,
const byte *  input,
size_t  length 
)
inlinevirtualinherited

Updates the hash with additional input and computes the hash of the current message.

Parameters
digesta pointer to the buffer to receive the hash
inputthe additional input as a buffer
lengththe 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().

virtual bool HashTransformation::Verify ( const byte *  digest)
inlinevirtualinherited

Verifies the hash of the current message.

Parameters
digesta pointer to the buffer of an existing hash
Returns
true if the existing hash matches the computed hash, false otherwise
Exceptions
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().

virtual bool HashTransformation::VerifyDigest ( const byte *  digest,
const byte *  input,
size_t  length 
)
inlinevirtualinherited

Updates the hash with additional input and verifies the hash of the current message.

Parameters
digesta pointer to the buffer of an existing hash
inputthe additional input as a buffer
lengththe size of the buffer, in bytes
Returns
true if the existing hash matches the computed hash, false otherwise
Exceptions
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().

virtual void HashTransformation::CalculateTruncatedDigest ( byte *  digest,
size_t  digestSize,
const byte *  input,
size_t  length 
)
inlinevirtualinherited

Updates the hash with additional input and computes the hash of the current message.

Parameters
digesta pointer to the buffer to receive the hash
digestSizethe length of the truncated hash, in bytes
inputthe additional input as a buffer
lengththe 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 
)
virtualinherited

Verifies the hash of the current message.

Parameters
digesta pointer to the buffer of an existing hash
digestLengththe size of the truncated hash, in bytes
Returns
true if the existing hash matches the computed hash, false otherwise
Exceptions
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().

virtual bool HashTransformation::VerifyTruncatedDigest ( const byte *  digest,
size_t  digestLength,
const byte *  input,
size_t  length 
)
inlinevirtualinherited

Updates the hash with additional input and verifies the hash of the current message.

Parameters
digesta pointer to the buffer of an existing hash
digestLengththe size of the truncated hash, in bytes
inputthe additional input as a buffer
lengththe size of the buffer, in bytes
Returns
true if the existing hash matches the computed hash, false otherwise
Exceptions
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.


The documentation for this class was generated from the following file: