Botan 3.5.0
Crypto and TLS for C&
streebog.h
Go to the documentation of this file.
1/*
2* Streebog
3* (C) 2017 Ribose Inc.
4*
5* Botan is released under the Simplified BSD License (see license.txt)
6*/
7
8#ifndef BOTAN_STREEBOG_H_
9#define BOTAN_STREEBOG_H_
10
11#include <botan/hash.h>
12
13#include <botan/internal/alignment_buffer.h>
14
15namespace Botan {
16
17/**
18* Streebog (GOST R 34.11-2012)
19* RFC 6986
20*/
21class Streebog final : public HashFunction {
22 public:
23 size_t output_length() const override { return m_output_bits / 8; }
24
25 std::unique_ptr<HashFunction> new_object() const override { return std::make_unique<Streebog>(m_output_bits); }
26
27 void clear() override;
28 std::string name() const override;
29
30 size_t hash_block_size() const override { return 64; }
31
32 std::unique_ptr<HashFunction> copy_state() const override;
33
34 explicit Streebog(size_t output_bits);
35
36 protected:
37 void add_data(std::span<const uint8_t> input) override;
38 void final_result(std::span<uint8_t> out) override;
39
40 void compress(const uint8_t input[], bool lastblock = false);
41
42 void compress_64(const uint64_t input[], bool lastblock = false);
43
44 private:
45 const size_t m_output_bits;
46 uint64_t m_count;
50};
51
52} // namespace Botan
53
54#endif
Alignment buffer helper.
void compress(const uint8_t input[], bool lastblock=false)
Definition streebog.cpp:122
void add_data(std::span< const uint8_t > input) override
Definition streebog.cpp:53
size_t output_length() const override
Definition streebog.h:23
std::unique_ptr< HashFunction > new_object() const override
Definition streebog.h:25
void compress_64(const uint64_t input[], bool lastblock=false)
Definition streebog.cpp:129
std::unique_ptr< HashFunction > copy_state() const override
Definition streebog.cpp:22
void final_result(std::span< uint8_t > out) override
Definition streebog.cpp:74
Streebog(size_t output_bits)
Definition streebog.cpp:26
void clear() override
Definition streebog.cpp:41
std::string name() const override
Definition streebog.cpp:34
size_t hash_block_size() const override
Definition streebog.h:30
int(* final)(unsigned char *, CTX *)
std::vector< T, secure_allocator< T > > secure_vector
Definition secmem.h:61