Botan 2.1.0 Crypto and TLS for C++11

- Main Page
- Namespaces
- Classes
- Files

- File List
- File Members

comb4p.h
Go to the documentation of this file.
1 /*
2 * Comb4P hash combiner
3 * (C) 2010 Jack Lloyd
4 *
5 * Botan is released under the Simplified BSD License (see license.txt)
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 final : 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 size_t hash_block_size() const override;
29
30 size_t output_length() const override
31 {
32 return m_hash1->output_length() + m_hash2->output_length();
33 }
34
35 HashFunction* clone() const override
36 {
37 return new Comb4P(m_hash1->clone(), m_hash2->clone());
38 }
39
40 std::string name() const override
41 {
42 return "Comb4P(" + m_hash1->name() + "," + m_hash2->name() + ")";
43 }
44
45 void clear() override;
46 private:
47 void add_data(const uint8_t input[], size_t length) override;
48 void final_result(uint8_t out[]) override;
49
50 std::unique_ptr<HashFunction> m_hash1, m_hash2;
51 };
52
53 }
54
55 #endif
Botan::Comb4P::name
std::string name() const override
Definition: comb4p.h:40
Botan
Definition: alg_id.cpp:13
Botan::HashFunction
Definition: hash.h:19
Botan::Comb4P::output_length
size_t output_length() const override
Definition: comb4p.h:30
Botan::Comb4P
Definition: comb4p.h:19
Botan::Comb4P::clone
HashFunction * clone() const override
Definition: comb4p.h:35