Coverage Report

Created: 2020-02-14 15:38

/src/botan/build/include/botan/blake2b.h
Line
Count
Source (jump to first uncovered line)
1
/*
2
* BLAKE2b
3
* (C) 2016 cynecx
4
*
5
* Botan is released under the Simplified BSD License (see license.txt)
6
*/
7
8
#ifndef BOTAN_BLAKE2B_H_
9
#define BOTAN_BLAKE2B_H_
10
11
#include <botan/hash.h>
12
#include <string>
13
#include <memory>
14
15
BOTAN_FUTURE_INTERNAL_HEADER(blake2b.h)
16
17
namespace Botan {
18
19
/**
20
* BLAKE2B
21
*/
22
class BOTAN_PUBLIC_API(2,0) BLAKE2b final : public HashFunction
23
   {
24
   public:
25
      /**
26
      * @param output_bits the output size of BLAKE2b in bits
27
      */
28
      explicit BLAKE2b(size_t output_bits = 512);
29
30
0
      size_t hash_block_size() const override { return 128; }
31
0
      size_t output_length() const override { return m_output_bits / 8; }
32
33
      HashFunction* clone() const override;
34
      std::string name() const override;
35
      void clear() override;
36
37
      std::unique_ptr<HashFunction> copy_state() const override;
38
39
   private:
40
      void add_data(const uint8_t input[], size_t length) override;
41
      void final_result(uint8_t out[]) override;
42
43
      void state_init();
44
      void compress(const uint8_t* data, size_t blocks, uint64_t increment);
45
46
      const size_t m_output_bits;
47
48
      secure_vector<uint8_t> m_buffer;
49
      size_t m_bufpos;
50
51
      secure_vector<uint64_t> m_H;
52
      uint64_t m_T[2];
53
      uint64_t m_F[2];
54
   };
55
56
typedef BLAKE2b Blake2b;
57
58
}
59
60
#endif