NullHash Class Reference

Inheritance diagram for NullHash:
HashTransformation Algorithm Clonable

List of all members.

Public Member Functions

void Update (const byte *input, size_t length)
 Updates a hash with additional input.
unsigned int DigestSize () const
 Provides the digest size of the hash.
void TruncatedFinal (byte *digest, size_t digestSize)
 Computes the hash of the current message.
bool TruncatedVerify (const byte *digest, size_t digestLength)
 Verifies the hash of the current message.
HashTransformationRef ()
 Provides a reference to this object.
virtual byte * CreateUpdateSpace (size_t &size)
 Request space which can be written into by the caller.
virtual void Final (byte *digest)
 Computes the hash of the current message.
virtual void Restart ()
 Restart the hash.
unsigned int TagSize () const
 Provides the tag size of the hash.
virtual unsigned int BlockSize () const
 Provides the block size of the compression function.
virtual unsigned int OptimalBlockSize () const
 Provides the input block size most efficient for this hash.
virtual unsigned int OptimalDataAlignment () const
 Provides input and output data alignment for optimal performance.
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 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.
virtual std::string AlgorithmName () const
 Provides the name of this algorithm.
virtual ClonableClone () const
 Copies this object.

Detailed Description

Definition at line 8 of file trunhash.h.


Member Function Documentation

void NullHash::Update ( const byte *  input,
size_t  length 
) [inline, virtual]

Updates a hash with additional input.

Parameters:
input the additional input as a buffer
length the size of the buffer, in bytes

Implements HashTransformation.

Definition at line 11 of file trunhash.h.

unsigned int NullHash::DigestSize (  )  const [inline, virtual]

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 13 of file trunhash.h.

void NullHash::TruncatedFinal ( byte *  digest,
size_t  digestSize 
) [inline, virtual]

Computes the hash of the current message.

Parameters:
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 15 of file trunhash.h.

bool NullHash::TruncatedVerify ( const byte *  digest,
size_t  digestLength 
) [inline, virtual]

Verifies the hash of the current message.

Parameters:
digest a pointer to the buffer of an existing hash
digestLength the 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 from HashTransformation.

Definition at line 17 of file trunhash.h.

HashTransformation& HashTransformation::Ref (  )  [inline, inherited]

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 byte* HashTransformation::CreateUpdateSpace ( size_t &  size  )  [inline, virtual, inherited]

Request space which can be written into by the caller.

Parameters:
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.

Note:
Some objects, like ArraySink, cannot create a space because its fixed. In the case of

Definition at line 879 of file cryptlib.h.

virtual void HashTransformation::Final ( byte *  digest  )  [inline, virtual, inherited]

Computes the hash of the current message.

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

virtual void HashTransformation::Restart (  )  [inline, virtual, inherited]

Restart the hash.

Discards the current state, and restart for a new message

Reimplemented in AuthenticatedSymmetricCipherBase, HMAC_Base, SHA3, and TruncatedHashTemplate< T >.

Definition at line 890 of file cryptlib.h.

Referenced by HMAC_Base::Restart().

unsigned int HashTransformation::TagSize (  )  const [inline, inherited]

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 DigestSize().

virtual unsigned int HashTransformation::BlockSize (  )  const [inline, virtual, inherited]

Provides the block size of the compression function.

Returns:
the block size of the compression function, in bytes

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 Weak::MD2, and VMAC_Base.

Definition at line 907 of file cryptlib.h.

Referenced by HMAC_Base::TruncatedFinal(), CBC_MAC_Base::TruncatedFinal(), and HMAC_Base::UncheckedSetKey().

virtual unsigned int HashTransformation::OptimalBlockSize (  )  const [inline, virtual, inherited]

Provides the input block size most efficient for this hash.

Returns:
The input block size that is most efficient for the cipher

The base class implemnetation returns MandatoryBlockSize().

Note:
Optimal input length is n * OptimalBlockSize() - GetOptimalBlockSizeUsed() for any n > 0.

Reimplemented in CMAC_Base, and HMAC_Base.

Definition at line 914 of file cryptlib.h.

unsigned int HashTransformation::OptimalDataAlignment (  )  const [virtual, inherited]

Provides input and output data alignment for optimal performance.

Returns:
the input data alignment that provides optimal performance

Reimplemented in CCM_Base, CMAC_Base, EAX_Base, GCM_Base, SHA3, and VMAC_Base.

Definition at line 242 of file cryptlib.cpp.

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.

Parameters:
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.

Parameters:
digest a 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 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.

Parameters:
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
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.

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.

Parameters:
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.

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.

Parameters:
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
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.

virtual std::string Algorithm::AlgorithmName (  )  const [inline, virtual, inherited]

Provides the name of this algorithm.

Returns:
the standard algorithm name

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.

Note:
AlgorithmName is not universally implemented yet

Reimplemented in Adler32, CCM_Base, CRC32, ClassNullRNG, AuthenticatedSymmetricCipher, DH_Domain< GROUP_PARAMETERS, COFACTOR_OPTION >, EAX_Base, StreamTransformationFilter, HashFilter, HashVerificationFilter, AuthenticatedDecryptionFilter, SignerFilter, SignatureVerificationFilter, GCM_Base, HMAC< T >, RDRAND, RDSEED, SHA3, BitBucket, and VMAC_Base.

Definition at line 488 of file cryptlib.h.

Referenced by BufferedTransformation::ChannelCreatePutSpace(), BufferedTransformation::ChannelFlush(), BufferedTransformation::ChannelMessageSeriesEnd(), BufferedTransformation::ChannelPut2(), TF_DecryptorBase::Decrypt(), TF_EncryptorBase::Encrypt(), StreamTransformation::ProcessLastBlock(), and PK_DefaultDecryptionFilter::Put2().

virtual Clonable* Clonable::Clone (  )  const [inline, virtual, inherited]

Copies this object.

Returns:
a copy of this object
Exceptions:
NotImplemented 
Note:
this is not implemented by most classes
See also:
NotCopyable

Definition at line 464 of file cryptlib.h.


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

Generated on 24 Mar 2016 for Crypto++ by  doxygen 1.6.1