diff options
author | lloyd <[email protected]> | 2010-04-17 17:41:33 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2010-04-17 17:41:33 +0000 |
commit | 941a184703fbdb979965d4ef9328a99535e692ae (patch) | |
tree | bb45a74039fb67bcdc4eb9e2a97af1370544d622 /src/hash/comb4p/comb4p.h | |
parent | e79090be74f21ab3663c1fe2662a8e8bd51606a4 (diff) |
Add Comb4P hash combiner, as described in Anja Lehmann's thesis.
Diffstat (limited to 'src/hash/comb4p/comb4p.h')
-rw-r--r-- | src/hash/comb4p/comb4p.h | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/src/hash/comb4p/comb4p.h b/src/hash/comb4p/comb4p.h new file mode 100644 index 000000000..ce66bb9c9 --- /dev/null +++ b/src/hash/comb4p/comb4p.h @@ -0,0 +1,47 @@ +/** +* Comb4P hash combiner +* (C) 2010 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ + +#ifndef BOTAN_COMB4P_H__ +#define BOTAN_COMB4P_H__ + +#include <botan/hash.h> + +namespace Botan { + +/** +* Combines two hash functions using a Feistel scheme. Described in +* "On the Security of Hash Function Combiners", Anja Lehmann +*/ +class Comb4P : public HashFunction + { + public: + Comb4P(HashFunction* h1, HashFunction* h2); + + ~Comb4P() { delete hash1; delete hash2; } + + HashFunction* clone() const + { + return new Comb4P(hash1->clone(), hash2->clone()); + } + + std::string name() const + { + return "Comb4P(" + hash1->name() + "," + hash2->name() + ")"; + } + + void clear(); + private: + void add_data(const byte input[], u32bit length); + void final_result(byte out[]); + + HashFunction* hash1; + HashFunction* hash2; + }; + +} + +#endif |