Botan 2.1.0 Crypto and TLS for C++11

- Main Page
- Namespaces
- Classes
- Files

- File List
- File Members

skein_512.h
Go to the documentation of this file.
1 /*
2 * The Skein-512 hash function
3 * (C) 2009,2014 Jack Lloyd
4 *
5 * Botan is released under the Simplified BSD License (see license.txt)
6 */
7
8 #ifndef BOTAN_SKEIN_512_H__
9 #define BOTAN_SKEIN_512_H__
10
11 #include <botan/hash.h>
12 #include <botan/threefish.h>
13 #include <string>
14 #include <memory>
15
16 namespace Botan {
17
18 /**
19 * Skein-512, a SHA-3 candidate
20 */
21 class BOTAN_DLL Skein_512 final : public HashFunction
22 {
23 public:
24 /**
25 * @param output_bits the output size of Skein in bits
26 * @param personalization is a string that will parameterize the
27 * hash output
28 */
29 Skein_512(size_t output_bits = 512,
30 const std::string& personalization = "");
31
32 size_t hash_block_size() const override { return 64; }
33 size_t output_length() const override { return m_output_bits / 8; }
34
35 HashFunction* clone() const override;
36 std::string name() const override;
37 void clear() override;
38 private:
39 enum type_code {
40 SKEIN_KEY = 0,
41 SKEIN_CONFIG = 4,
42 SKEIN_PERSONALIZATION = 8,
43 SKEIN_PUBLIC_KEY = 12,
44 SKEIN_KEY_IDENTIFIER = 16,
45 SKEIN_NONCE = 20,
46 SKEIN_MSG = 48,
47 SKEIN_OUTPUT = 63
48 };
49
50 void add_data(const uint8_t input[], size_t length) override;
51 void final_result(uint8_t out[]) override;
52
53 void ubi_512(const uint8_t msg[], size_t msg_len);
54
55 void initial_block();
56 void reset_tweak(type_code type, bool is_final);
57
58 std::string m_personalization;
59 size_t m_output_bits;
60
61 std::unique_ptr<Threefish_512> m_threefish;
62 secure_vector<uint64_t> m_T;
63 secure_vector<uint8_t> m_buffer;
64 size_t m_buf_pos;
65 };
66
67 }
68
69 #endif
Botan::Skein_512::hash_block_size
size_t hash_block_size() const override
Definition: skein_512.h:32
type
MechanismType type
Definition: p11_mechanism.cpp:43
Botan::Skein_512
Definition: skein_512.h:21
Botan
Definition: alg_id.cpp:13
Botan::HashFunction
Definition: hash.h:19
Botan::Skein_512::output_length
size_t output_length() const override
Definition: skein_512.h:33