Coverage Report

Created: 2022-01-14 08:07

/src/botan/build/include/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
   {
21
   public:
22
      /**
23
      * @param h1 the first hash
24
      * @param h2 the second hash
25
      */
26
      Comb4P(std::unique_ptr<HashFunction> h1, std::unique_ptr<HashFunction> h2);
27
28
      size_t hash_block_size() const override;
29
30
      size_t output_length() const override
31
0
         {
32
0
         return m_hash1->output_length() + m_hash2->output_length();
33
0
         }
34
35
      std::unique_ptr<HashFunction> new_object() const override
36
0
         {
37
0
         return std::make_unique<Comb4P>(m_hash1->new_object(), m_hash2->new_object());
38
0
         }
39
40
      std::unique_ptr<HashFunction> copy_state() const override;
41
42
      std::string name() const override
43
0
         {
44
0
         return "Comb4P(" + m_hash1->name() + "," + m_hash2->name() + ")";
45
0
         }
46
47
      void clear() override;
48
   private:
49
0
      Comb4P() = default;
50
51
      void add_data(const uint8_t input[], size_t length) override;
52
      void final_result(uint8_t out[]) override;
53
54
      std::unique_ptr<HashFunction> m_hash1, m_hash2;
55
   };
56
57
}
58
59
#endif