diff options
author | lloyd <[email protected]> | 2010-12-10 19:24:04 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2010-12-10 19:24:04 +0000 |
commit | d88bac8367c673615869a0f6cc32a5c06f4ad876 (patch) | |
tree | 14d431f5ab079b5f85165d825c993b34f843bfc3 /src/hash/keccak/keccak.h | |
parent | 57c189ce630f5c21aacd49864256a997f52c01c1 (diff) |
Add a simple but functioning implementation of Keccak. Only the
proposed SHA-3 parameter sets are supported.
Diffstat (limited to 'src/hash/keccak/keccak.h')
-rw-r--r-- | src/hash/keccak/keccak.h | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/src/hash/keccak/keccak.h b/src/hash/keccak/keccak.h new file mode 100644 index 000000000..62269c9a1 --- /dev/null +++ b/src/hash/keccak/keccak.h @@ -0,0 +1,44 @@ +/* +* Keccak +* (C) 2010 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ + +#ifndef BOTAN_KECCAK_H__ +#define BOTAN_KECCAK_H__ + +#include <botan/hash.h> +#include <botan/secmem.h> +#include <string> + +namespace Botan { + +/** +* Keccak[1600], a SHA-3 candidate +*/ +class BOTAN_DLL Keccak_1600 : public HashFunction + { + public: + Keccak_1600(size_t output_bits = 512); + + size_t hash_block_size() const { return bitrate / 8; } + size_t output_length() const { return output_bits / 8; } + + HashFunction* clone() const; + std::string name() const; + void clear(); + private: + void add_data(const byte input[], size_t length); + void final_result(byte out[]); + + size_t output_bits, bitrate; + byte diversifier; + SecureVector<u64bit> S; + SecureVector<byte> buffer; + size_t buf_pos; + }; + +} + +#endif |