Botan  2.11.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 */
19 class BOTAN_PUBLIC_API(2,2) Streebog : public HashFunction
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  void compress_64(const uint64_t input[], bool lastblock = false);
39 
40  private:
41  const size_t m_output_bits;
42  uint64_t m_count;
43  size_t m_position;
44  secure_vector<uint8_t> m_buffer;
45  secure_vector<uint64_t> m_h;
46  secure_vector<uint64_t> m_S;
47  };
48 
49 
50 /**
51 * Streebog-256
52 */
53 class BOTAN_PUBLIC_API(2,2) Streebog_256 final : public Streebog
54  {
55  public:
56  Streebog_256() : Streebog(256) {}
57  };
58 
59 /**
60 * Streebog-512
61 */
62 class BOTAN_PUBLIC_API(2,2) Streebog_512 final : public Streebog
63  {
64  public:
65  Streebog_512() : Streebog(512) {}
66  };
67 
68 }
69 
70 #endif
size_t * output_length
Definition: ffi.h:280
int(* final)(unsigned char *, CTX *)
char * name
Definition: ffi.h:330
Definition: alg_id.cpp:13
uint8_t out[]
Definition: pbkdf2.h:19
class BOTAN_PUBLIC_API(2, 0) AlgorithmIdentifier final bool BOTAN_PUBLIC_API(2, 0) operator
Name Constraints.
Definition: asn1_obj.h:66
size_t const uint8_t input[]
Definition: base32.h:30