1 #ifndef CRYPTOPP_ITERHASH_H 2 #define CRYPTOPP_ITERHASH_H 17 : InvalidDataFormat(
"IteratedHashBase: input data exceeds maximum allowed by hash function " + alg) {}
26 template <
class T,
class BASE>
30 typedef T HashWordType;
50 void Update(
const byte *input,
size_t length);
60 byte * CreateUpdateSpace(
size_t &size);
71 void TruncatedFinal(byte *digest,
size_t digestSize);
74 inline T GetBitCountHi()
const {
return (m_countLo >> (8*
sizeof(T)-3)) + (m_countHi << 3);}
75 inline T GetBitCountLo()
const {
return m_countLo << 3;}
77 void PadLastBlock(
unsigned int lastBlockSize, byte padFirst=0x80);
78 virtual void Init() =0;
80 virtual ByteOrder GetByteOrder()
const =0;
81 virtual void HashEndianCorrectedBlock(
const HashWordType *data) =0;
82 virtual size_t HashMultipleBlocks(
const T *input,
size_t length);
83 void HashBlock(
const HashWordType *input) {HashMultipleBlocks(input, this->
BlockSize());}
85 virtual T* DataBuf() =0;
86 virtual T* StateBuf() =0;
89 T m_countLo, m_countHi;
100 template <
class T_HashWordType,
class T_Endianness,
unsigned int T_BlockSize,
class T_Base = HashTransformation>
104 typedef T_Endianness ByteOrderClass;
105 typedef T_HashWordType HashWordType;
107 #ifndef CRYPTOPP_MAINTAIN_BACKWARDS_COMPATIBILITY_562 111 CRYPTOPP_CONSTANT(BLOCKSIZE = T_BlockSize)
137 T_HashWordType* DataBuf() {
return this->m_data;}
151 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>
153 :
public ClonableImpl<T_Transform, AlgorithmImpl<IteratedHash<T_HashWordType, T_Endianness, T_BlockSize>, T_Transform> >
157 #ifndef CRYPTOPP_MAINTAIN_BACKWARDS_COMPATIBILITY_562 161 CRYPTOPP_CONSTANT(DIGESTSIZE = T_DigestSize ? T_DigestSize : T_StateSize)
170 void HashEndianCorrectedBlock(
const T_HashWordType *data) {T_Transform::Transform(this->m_state, data);}
171 void Init() {T_Transform::InitState(this->m_state);}
173 T_HashWordType* StateBuf() {
return this->m_state;}
const char * DigestSize()
int, in bytes
IteratedHashBase()
Construct an IteratedHashBase.
Classes providing basic library services.
Utility functions for the Crypto++ library.
ByteOrder
Provides the byte ordering.
Base class for identifying alogorithm.
Abstract base classes that provide a uniform interface to this library.
unsigned int BlockSize() const
Provides the block size of the hash.
Classes and functions for secure memory allocations.
ByteOrder GetByteOrder() const
Provides the byte order of the hash.
#define CRYPTOPP_COMPILE_ASSERT(expr)
Compile time assertion.
T ConditionalByteReverse(ByteOrder order, T value)
Reverses bytes in a value depending upon endianess.
Fixed size stack-based SecBlock with 16-byte alignment.
void CorrectEndianess(HashWordType *out, const HashWordType *in, size_t byteCount)
Adjusts the byte ordering of the hash.
Fixed size stack-based SecBlock.
const char * BlockSize()
int, in bytes
unsigned int OptimalBlockSize() const
Provides the input block size most efficient for this cipher.
unsigned int OptimalDataAlignment() const
Provides input and output data alignment for optimal performance.
Iterated hash base class.
Iterated hash base class.
Crypto++ library namespace.