Botan  2.4.0
Crypto and TLS for C++11
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 namespace Botan {
14 
15 /**
16 * Streebog (GOST R 34.11-2012)
17 * RFC 6986
18 */
20  {
21  public:
22  size_t output_length() const override { return m_output_bits / 8; }
23 
24  HashFunction* clone() const override { return new Streebog(m_output_bits); }
25  void clear() override;
26  std::string name() const override;
27  size_t hash_block_size() const override { return 64; };
28 
29  std::unique_ptr<HashFunction> copy_state() const override;
30 
31  explicit Streebog(size_t output_bits);
32  protected:
33  void add_data(const uint8_t input[], size_t length) override;
34  void final_result(uint8_t out[]) override;
35 
36  void compress(const uint8_t input[], bool lastblock = false);
37 
38  private:
39  const size_t m_output_bits;
40  uint64_t m_count;
41  size_t m_position;
42  secure_vector<uint8_t> m_buffer;
45  };
46 
47 
48 /**
49 * Streebog-256
50 */
51 class BOTAN_PUBLIC_API(2,2) Streebog_256 final : public Streebog
52  {
53  public:
54  Streebog_256() : Streebog(256) {}
55  };
56 
57 /**
58 * Streebog-512
59 */
60 class BOTAN_PUBLIC_API(2,2) Streebog_512 final : public Streebog
61  {
62  public:
63  Streebog_512() : Streebog(512) {}
64  };
65 
66 }
67 
68 #endif
HashFunction * clone() const override
Definition: streebog.h:24
size_t output_length() const override
Definition: streebog.h:22
#define BOTAN_PUBLIC_API(maj, min)
Definition: compiler.h:27
size_t hash_block_size() const override
Definition: streebog.h:27
Definition: alg_id.cpp:13
std::vector< T, secure_allocator< T > > secure_vector
Definition: secmem.h:88