Botan 2.1.0 Crypto and TLS for C++11

- Main Page
- Namespaces
- Classes
- Files

- File List
- File Members

blake2b.h
Go to the documentation of this file.
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 namespace Botan {
16
17 enum blake2b_constant {
18 BLAKE2B_BLOCKBYTES = 128,
19 BLAKE2B_OUTBYTES = 64,
20 BLAKE2B_IVU64COUNT = 8
21 };
22
23 /**
24 * BLAKE2B
25 */
26 class BOTAN_DLL Blake2b final : public HashFunction
27 {
28 public:
29 /**
30 * @param output_bits the output size of Blake2b in bits
31 */
32 explicit Blake2b(size_t output_bits = 512);
33
34 size_t hash_block_size() const override { return BLAKE2B_BLOCKBYTES; }
35 size_t output_length() const override { return m_output_bits / 8; }
36
37 HashFunction* clone() const override;
38 std::string name() const override;
39 void clear() override;
40
41 private:
42 void add_data(const uint8_t input[], size_t length) override;
43 void final_result(uint8_t out[]) override;
44
45 inline void state_init();
46 inline void increment_counter(const uint64_t inc);
47 void compress(bool lastblock = false);
48
49 size_t m_output_bits;
50
51 secure_vector<uint8_t> m_buffer;
52 size_t m_buflen;
53
54 secure_vector<uint64_t> m_H;
55 uint64_t m_T[2];
56 uint64_t m_F[2];
57 };
58
59 }
60
61 #endif
Botan::Blake2b
Definition: blake2b.h:26
Botan::BLAKE2B_OUTBYTES
Definition: blake2b.h:19
Botan::BLAKE2B_BLOCKBYTES
Definition: blake2b.h:18
Botan::Blake2b::hash_block_size
size_t hash_block_size() const override
Definition: blake2b.h:34
Botan::blake2b_constant
blake2b_constant
Definition: blake2b.h:17
Botan::secure_vector
std::vector< T, secure_allocator< T >> secure_vector
Definition: secmem.h:121
Botan
Definition: alg_id.cpp:13
Botan::HashFunction
Definition: hash.h:19
Botan::BLAKE2B_IVU64COUNT
Definition: blake2b.h:20
Botan::Blake2b::output_length
size_t output_length() const override
Definition: blake2b.h:35