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)
166 unsigned
int DigestSize()
const {
return DIGESTSIZE;};
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;}