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