/src/botan/build/include/internal/botan/internal/comb4p.h
Line | Count | Source (jump to first uncovered line) |
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 Comb4P final : public HashFunction { |
20 | | public: |
21 | | /** |
22 | | * @param h1 the first hash |
23 | | * @param h2 the second hash |
24 | | */ |
25 | | Comb4P(std::unique_ptr<HashFunction> h1, std::unique_ptr<HashFunction> h2); |
26 | | |
27 | | size_t hash_block_size() const override; |
28 | | |
29 | 0 | size_t output_length() const override { return m_hash1->output_length() + m_hash2->output_length(); } |
30 | | |
31 | | std::unique_ptr<HashFunction> new_object() const override; |
32 | | |
33 | | std::unique_ptr<HashFunction> copy_state() const override; |
34 | | |
35 | | std::string name() const override; |
36 | | |
37 | | void clear() override; |
38 | | |
39 | | private: |
40 | 0 | Comb4P() = default; |
41 | | |
42 | | void add_data(std::span<const uint8_t> input) override; |
43 | | void final_result(std::span<uint8_t> out) override; |
44 | | |
45 | | std::unique_ptr<HashFunction> m_hash1, m_hash2; |
46 | | }; |
47 | | |
48 | | } // namespace Botan |
49 | | |
50 | | #endif |