#include <chnhash/chnhash.hxx>
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 values 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 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)=0;This pure virtual method needs to be 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 high endian byte string.
virtual void ProcessFinalBlock(const void* block, const int size)=0;This pure virtual method needs to be 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 high endian byte string of length size, where size is to be less than or equal to the block size of the chain hash function, and may be zero.
virtual void Compress(const void* iv, const void* block, void* result) const=0;This pure virtual method needs to be overloaded to write into the memory pointed to by result a high endian byte string giving the concatenation of the new values of the chain variables when the compression function is evaluated at the point determined by the block pointed to by block and concatenation of the chain variables pointed to by iv.
iv is to point to a high endian byte string giving the concatenation of the chain variables, while block is to point to a high endian byte string giving the value of the block.
virtual void Reset()=0;This pure virtual method needs to be overloaded to set _bitCout equal to zero and to set the chain variables equal to the initial value of the chain hash function.
void ChainVariables(void* buffer) const=0;This pure virtual methods neeeds to be overloaded to write a high endian byte string representing the concatenation of the chain variables into the memory pointed to by buffer.