Botan 1.10.17

comb4p.h
Go to the documentation of this file.
1 /*
2 * Comb4P hash combiner
3 * (C) 2010 Jack Lloyd
4 *
5 * Distributed under the terms of the Botan license
6 */
7
8 #ifndef BOTAN_COMB4P_H__
9 #define BOTAN_COMB4P_H__
10
11 #include <botan/hash.h>
12
13 namespace Botan {
14
15 /**
16 * Combines two hash functions using a Feistel scheme. Described in
17 * "On the Security of Hash Function Combiners", Anja Lehmann
18 */
19 class BOTAN_DLL Comb4P : public HashFunction
20 {
21 public:
22 /**
23 * @param h1 the first hash
24 * @param h2 the second hash
25 */
26 Comb4P(HashFunction* h1, HashFunction* h2);
27
28 ~Comb4P() { delete hash1; delete hash2; }
29
30 size_t hash_block_size() const;
31
32 size_t output_length() const
33 {
34 return hash1->output_length() + hash2->output_length();
35 }
36
37 HashFunction* clone() const
38 {
39 return new Comb4P(hash1->clone(), hash2->clone());
40 }
41
42 std::string name() const
43 {
44 return "Comb4P(" + hash1->name() + "," + hash2->name() + ")";
45 }
46
47 void clear();
48 private:
49 void add_data(const byte input[], size_t length);
50 void final_result(byte out[]);
51
52 HashFunction* hash1;
53 HashFunction* hash2;
54 };
55
56 }
57
58 #endif
Botan::Comb4P::output_length
size_t output_length() const
Definition: comb4p.h:32
Botan::byte
unsigned char byte
Definition: types.h:22
Botan::Comb4P::~Comb4P
~Comb4P()
Definition: comb4p.h:28
Botan
Definition: algo_base.h:14
Botan::HashFunction
Definition: hash.h:20
Botan::Comb4P::clone
HashFunction * clone() const
Definition: comb4p.h:37
Botan::Comb4P
Definition: comb4p.h:19
Botan::Comb4P::name
std::string name() const
Definition: comb4p.h:42