Botan 2.13.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 BOTAN_FUTURE_INTERNAL_HEADER(comb4p.h)
14
15 namespace Botan {
16
17 /**
18 * Combines two hash functions using a Feistel scheme. Described in
19 * "On the Security of Hash Function Combiners", Anja Lehmann
20 */
21 class BOTAN_PUBLIC_API(2,0) Comb4P final : public HashFunction
22 {
23 public:
24 /**
25 * @param h1 the first hash
26 * @param h2 the second hash
27 */
28 Comb4P(HashFunction* h1, HashFunction* h2);
29
30 size_t hash_block_size() const override;
31
32 size_t output_length() const override
33 {
34 return m_hash1->output_length() + m_hash2->output_length();
35 }
36
37 HashFunction* clone() const override
38 {
39 return new Comb4P(m_hash1->clone(), m_hash2->clone());
40 }
41
42 std::unique_ptr<HashFunction> copy_state() const override;
43
44 std::string name() const override
45 {
46 return "Comb4P(" + m_hash1->name() + "," + m_hash2->name() + ")";
47 }
48
49 void clear() override;
50 private:
51 Comb4P() = default;
52
53 void add_data(const uint8_t input[], size_t length) override;
54 void final_result(uint8_t out[]) override;
55
56 std::unique_ptr<HashFunction> m_hash1, m_hash2;
57 };
58
59 }
60
61 #endif
final
int(* final)(unsigned char *, CTX *)
Definition: commoncrypto_hash.cpp:28
BOTAN_PUBLIC_API
#define BOTAN_PUBLIC_API(maj, min)
Definition: compiler.h:31
Botan::Comb4P::name
std::string name() const override
Definition: comb4p.h:44
Botan
Definition: alg_id.cpp:13
Botan::HashFunction::hash_block_size
virtual size_t hash_block_size() const
Definition: hash.h:75
Botan::HashFunction
Definition: hash.h:20
Botan::HashFunction::clear
virtual void clear()=0
Botan::Comb4P::output_length
size_t output_length() const override
Definition: comb4p.h:32
Botan::Comb4P
Definition: comb4p.h:21
Botan::Comb4P::clone
HashFunction * clone() const override
Definition: comb4p.h:37
Botan::HashFunction::copy_state
virtual std::unique_ptr< HashFunction > copy_state() const =0
BOTAN_FUTURE_INTERNAL_HEADER
#define BOTAN_FUTURE_INTERNAL_HEADER(hdr)
Definition: compiler.h:139