/src/botan/build/include/internal/botan/internal/siphash.h
Line | Count | Source (jump to first uncovered line) |
1 | | /* |
2 | | * SipHash |
3 | | * (C) 2014,2015 Jack Lloyd |
4 | | * |
5 | | * Botan is released under the Simplified BSD License (see license.txt) |
6 | | */ |
7 | | |
8 | | #ifndef BOTAN_SIPHASH_H_ |
9 | | #define BOTAN_SIPHASH_H_ |
10 | | |
11 | | #include <botan/mac.h> |
12 | | |
13 | | namespace Botan { |
14 | | |
15 | | class SipHash final : public MessageAuthenticationCode { |
16 | | public: |
17 | 0 | SipHash(size_t c = 2, size_t d = 4) : m_C(c), m_D(d) {} |
18 | | |
19 | | void clear() override; |
20 | | std::string name() const override; |
21 | | |
22 | | std::unique_ptr<MessageAuthenticationCode> new_object() const override; |
23 | | |
24 | 0 | size_t output_length() const override { return 8; } |
25 | | |
26 | | bool has_keying_material() const override; |
27 | | |
28 | 0 | Key_Length_Specification key_spec() const override { return Key_Length_Specification(16); } |
29 | | |
30 | | private: |
31 | | void add_data(std::span<const uint8_t>) override; |
32 | | void final_result(std::span<uint8_t>) override; |
33 | | void key_schedule(std::span<const uint8_t>) override; |
34 | | |
35 | | const size_t m_C, m_D; |
36 | | secure_vector<uint64_t> m_K; |
37 | | secure_vector<uint64_t> m_V; |
38 | | uint64_t m_mbuf = 0; |
39 | | size_t m_mbuf_pos = 0; |
40 | | uint8_t m_words = 0; |
41 | | }; |
42 | | |
43 | | } // namespace Botan |
44 | | |
45 | | #endif |