#include <chnhash/chnhash.hpp>
u64 _bitCount;This variable is used to keep track of how many bits have been processed so far in the bit string the chain hash function is being evaluated at.
int _bitsPerBlock;This is the number of bits in the blocks the compression function operates on.
int _bitsInHash;This is the sum of the lengths of the bit strings the chain variables take value in.
ChainHash(const int bitsPerBlock, const int bitsInHash);Used in creating a ChainHash instance for a chain hash function operating on blocks bitsPerBlock bits in length, and having a sum over the lengths of its chain variables equal to bitsInHash bits.
virtual ~ChainHash();Nothing special is done by this part of the desctructor.
inline int bitsPerBlock() const;Returns the number of bits in the blocks the compression function operates on.
inline int bitsInHash() const;Returns the sum of the lengths (in bits) of the chain variables.
virtual void ProcessMiddleBlock(const void* block, const int aligned=0)=0;This pure virtual method is overloaded to replace the value of the chain variables by the value of the compression function at the point determined by the chain variables and the block pointed to by block.
block is to point to a byte string stored in the order
b[0]b[1]b[2]b[3]...b[63].aligned is to be non-zero iff the byte string is aligned on a boundary appropriate for the function. (For all the subclasses provided the appropriate alignment is on a dword boundary, which is to say that the address specified by block should be congruent to 0 mod 32.)
virtual void ProcessFinalBlock(const void* block, const int bytes)=0;This pure virtual method is overloaded to update the chain variables when processing the last block or partial block in the bit string the chain hash function is being evaluated at.
block is to point to an unpadded byte string in the order
b[0]b[1]b[2]b[3]...b[bytes].bytes must be less than or equal to the block size of the chain hash function, and may be zero.
virtual void Reset();This virtual method sets _bitCout equal to zero. Subclasses overload it to set their chain variables equal to the initial value as well.
void ChainVariables(void* buffer) const=0;This pure virtual method is overloaded to write a byte string representing the concatenation of the chain variables into the memory pointed to by buffer. The endianness of this bytes string depends on the chain hash function. For SHA subclasses the byte string will be high endian, whereas for MD4ish subclasses the byte string will be little endian.