diff options
Diffstat (limited to 'src/hash/mdx_hash/mdx_hash.h')
-rw-r--r-- | src/hash/mdx_hash/mdx_hash.h | 40 |
1 files changed, 34 insertions, 6 deletions
diff --git a/src/hash/mdx_hash/mdx_hash.h b/src/hash/mdx_hash/mdx_hash.h index 2d70deed3..087c7fc46 100644 --- a/src/hash/mdx_hash/mdx_hash.h +++ b/src/hash/mdx_hash/mdx_hash.h @@ -1,4 +1,4 @@ -/** +/* * MDx Hash Function * (C) 1999-2008 Jack Lloyd * @@ -18,16 +18,44 @@ namespace Botan { class BOTAN_DLL MDx_HashFunction : public HashFunction { public: - MDx_HashFunction(u32bit, u32bit, bool, bool, u32bit = 8); + /** + * @param hash_length is the output length of this hash + * @param block_length is the number of bytes per block + * @param big_byte_endian specifies if the hash uses big-endian bytes + * @param big_bit_endian specifies if the hash uses big-endian bits + * @param counter_size specifies the size of the counter var in bytes + */ + MDx_HashFunction(u32bit hash_length, + u32bit block_length, + bool big_byte_endian, + bool big_bit_endian, + u32bit counter_size = 8); + virtual ~MDx_HashFunction() {} protected: - void add_data(const byte[], u32bit); + void add_data(const byte input[], u32bit length); void final_result(byte output[]); - virtual void compress_n(const byte block[], u32bit block_n) = 0; + + /** + * Run the hash's compression function over a set of blocks + * @param blocks the input + * @param block_n the number of blocks + */ + virtual void compress_n(const byte blocks[], u32bit block_n) = 0; void clear(); - virtual void copy_out(byte[]) = 0; - virtual void write_count(byte[]); + + /** + * Copy the output to the buffer + * @param buffer to put the output into + */ + virtual void copy_out(byte buffer[]) = 0; + + /** + * Write the count, if used, to this spot + * @param out where to write the counter to + */ + virtual void write_count(byte out[]); private: SecureVector<byte> buffer; u64bit count; |