Botan 3.9.0
Crypto and TLS for C&
blake2bmac.h
Go to the documentation of this file.
1/*
2* BLAKE2b MAC
3* (C) 1999-2007,2014 Jack Lloyd
4* (C) 2020 Tom Crowley
5*
6* Botan is released under the Simplified BSD License (see license.txt)
7*/
8
9#ifndef BOTAN_BLAKE2MAC_H_
10#define BOTAN_BLAKE2MAC_H_
11
12#include <botan/mac.h>
13#include <botan/internal/blake2b.h>
14
15namespace Botan {
16
17/**
18* BLAKE2b MAC
19*/
21 public:
22 explicit BLAKE2bMAC(size_t output_bits = 512);
23
24 std::string name() const override { return m_blake.name(); }
25
26 size_t output_length() const override { return m_blake.output_length(); }
27
28 std::unique_ptr<MessageAuthenticationCode> new_object() const override;
29
30 void clear() override;
31
32 bool has_keying_material() const override { return m_blake.has_keying_material(); }
33
34 Key_Length_Specification key_spec() const override { return m_blake.key_spec(); }
35
36 private:
37 void key_schedule(std::span<const uint8_t> key) override { m_blake.set_key(key); }
38
39 void add_data(std::span<const uint8_t> input) override {
41 m_blake.update(input);
42 }
43
44 void final_result(std::span<uint8_t> out) override {
46 m_blake.final(out);
47 }
48
49 BLAKE2b m_blake;
50};
51
52} // namespace Botan
53
54#endif
void clear() override
std::unique_ptr< MessageAuthenticationCode > new_object() const override
size_t output_length() const override
Definition blake2bmac.h:26
bool has_keying_material() const override
Definition blake2bmac.h:32
std::string name() const override
Definition blake2bmac.h:24
BLAKE2bMAC(size_t output_bits=512)
Key_Length_Specification key_spec() const override
Definition blake2bmac.h:34
void update(const uint8_t in[], size_t length)
Definition buf_comp.h:34
void final(uint8_t out[])
Definition buf_comp.h:69
void assert_key_material_set() const
Definition sym_algo.h:146
void set_key(const OctetString &key)
Definition sym_algo.cpp:14