Botan 2.13.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 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 size_t hash_block_size() const override { return 128; }
31 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
Botan::Blake2b
BLAKE2b Blake2b
Definition: blake2b.h:56
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::HashFunction::name
virtual std::string name() const =0
Botan::HashFunction::clone
virtual HashFunction * clone() const =0
Botan::secure_vector
std::vector< T, secure_allocator< T >> secure_vector
Definition: secmem.h:65
Botan
Definition: alg_id.cpp:13
Botan::BLAKE2b::hash_block_size
size_t hash_block_size() const override
Definition: blake2b.h:30
Botan::HashFunction
Definition: hash.h:20
Botan::BLAKE2b
Definition: blake2b.h:22
Botan::HashFunction::clear
virtual void clear()=0
Botan::HashFunction::copy_state
virtual std::unique_ptr< HashFunction > copy_state() const =0
Botan::BLAKE2b::output_length
size_t output_length() const override
Definition: blake2b.h:31
BOTAN_FUTURE_INTERNAL_HEADER
#define BOTAN_FUTURE_INTERNAL_HEADER(hdr)
Definition: compiler.h:139