Crypto++  5.6.5
Free C++ class library of cryptographic schemes
Public Types | Public Member Functions | List of all members
IteratedHashBase< T, BASE > Class Template Referenceabstract

Iterated hash base class. More...

+ Inheritance diagram for IteratedHashBase< T, BASE >:

Public Types

typedef T HashWordType
 

Public Member Functions

 IteratedHashBase ()
 Construct an IteratedHashBase.
 
unsigned int OptimalBlockSize () const
 Provides the input block size most efficient for this cipher. 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...
 
byte * CreateUpdateSpace (size_t &size)
 Requests space which can be written into by the caller. More...
 
void Restart ()
 Restart the hash. More...
 
void TruncatedFinal (byte *digest, size_t digestSize)
 Computes the hash of the current message. More...
 

Detailed Description

template<class T, class BASE>
class IteratedHashBase< T, BASE >

Iterated hash base class.

Template Parameters
THash word type
BASEHashTransformation derived class

IteratedHashBase provides an interface for block-based iterated hashes

See also
HashTransformation, MessageAuthenticationCode

Definition at line 27 of file iterhash.h.

Member Function Documentation

template<class T, class BASE>
unsigned int IteratedHashBase< T, BASE >::OptimalBlockSize ( ) const
inline

Provides the input block size most efficient for this cipher.

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

The base class implementation returns MandatoryBlockSize().

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

Definition at line 40 of file iterhash.h.

template<class T, class BASE>
unsigned int IteratedHashBase< T, BASE >::OptimalDataAlignment ( ) const
inline

Provides input and output data alignment for optimal performance.

Returns
the input data alignment that provides optimal performance

OptimalDataAlignment returnes the natural alignment of the hash word.

Definition at line 45 of file iterhash.h.

template<class T , class BASE >
void IteratedHashBase< T, BASE >::Update ( const byte *  input,
size_t  length 
)

Updates a hash with additional input.

Parameters
inputthe additional input as a buffer
lengththe size of the buffer, in bytes

Definition at line 12 of file iterhash.cpp.

template<class T , class BASE >
byte * IteratedHashBase< T, BASE >::CreateUpdateSpace ( size_t &  size)

Requests space which can be written into by the caller.

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

Definition at line 75 of file iterhash.cpp.

template<class T , class BASE >
void IteratedHashBase< T, BASE >::Restart ( )

Restart the hash.

Discards the current state, and restart for a new message

Definition at line 122 of file iterhash.cpp.

template<class T , class BASE >
void IteratedHashBase< T, BASE >::TruncatedFinal ( byte *  digest,
size_t  digestSize 
)

Computes the hash of the current message.

Parameters
digesta pointer to the buffer to receive the hash
digestSizethe size of the truncated digest, in bytes

TruncatedFinal() call Final() and then copies digestSize bytes to digest. The hash is restarted the hash for the next message.

Definition at line 128 of file iterhash.cpp.


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