3 #ifndef CRYPTOPP_ITERHASH_H 4 #define CRYPTOPP_ITERHASH_H 11 #if CRYPTOPP_MSC_VERSION 12 # pragma warning(push) 13 # pragma warning(disable: 4231 4275) 14 # if (CRYPTOPP_MSC_VERSION >= 1400) 15 # pragma warning(disable: 6011 6386 28193) 26 :
InvalidDataFormat(
"IteratedHashBase: input data exceeds maximum allowed by hash function " + alg) {}
34 template <
class T,
class BASE>
38 typedef T HashWordType;
60 void Update(
const byte *input,
size_t length);
70 byte * CreateUpdateSpace(
size_t &size);
81 void TruncatedFinal(byte *digest,
size_t digestSize);
94 inline T GetBitCountHi()
const 95 {
return (m_countLo >> (8*
sizeof(T)-3)) + (m_countHi << 3);}
96 inline T GetBitCountLo()
const 97 {
return m_countLo << 3;}
99 void PadLastBlock(
unsigned int lastBlockSize, byte padFirst=0x80);
100 virtual void Init() =0;
102 virtual ByteOrder GetByteOrder()
const =0;
103 virtual void HashEndianCorrectedBlock(
const HashWordType *data) =0;
104 virtual size_t HashMultipleBlocks(
const T *input,
size_t length);
105 void HashBlock(
const HashWordType *input)
106 {HashMultipleBlocks(input, this->
BlockSize());}
108 virtual T* DataBuf() =0;
109 virtual T* StateBuf() =0;
112 T m_countLo, m_countHi;
122 template <
class T_HashWordType,
class T_Endianness,
unsigned int T_BlockSize,
class T_Base = HashTransformation>
126 typedef T_Endianness ByteOrderClass;
127 typedef T_HashWordType HashWordType;
129 CRYPTOPP_CONSTANT(BLOCKSIZE = T_BlockSize)
162 T_HashWordType* DataBuf() {
return this->m_data;}
175 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>
177 :
public ClonableImpl<T_Transform, AlgorithmImpl<IteratedHash<T_HashWordType, T_Endianness, T_BlockSize>, T_Transform> >
180 CRYPTOPP_CONSTANT(DIGESTSIZE = T_DigestSize ? T_DigestSize : T_StateSize)
191 void HashEndianCorrectedBlock(
const T_HashWordType *data) {T_Transform::Transform(this->m_state, data);}
192 void Init() {T_Transform::InitState(this->m_state);}
194 T_HashWordType* StateBuf() {
return this->m_state;}
198 #if !defined(__GNUC__) && !defined(__clang__) 208 #if CRYPTOPP_MSC_VERSION 209 # pragma warning(pop) 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 endianness.
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.
#define CRYPTOPP_ASSERT(exp)
Debugging and diagnostic assertion.
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.
virtual std::string AlgorithmProvider() const
Retrieve the provider of this algorithm.
Iterated hash base class.
Crypto++ library namespace.