blob: d774fe5e7e9f58d9a855bf56d548b3e2a14daa32 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
/*
* SipHash
* (C) 2014,2015 Jack Lloyd
*
* Botan is released under the Simplified BSD License (see license.txt)
*/
#ifndef BOTAN_SIPHASH_H__
#define BOTAN_SIPHASH_H__
#include <botan/mac.h>
namespace Botan {
class BOTAN_DLL SipHash final : public MessageAuthenticationCode
{
public:
SipHash(size_t c = 2, size_t d = 4) : m_C(c), m_D(d) {}
void clear() override;
std::string name() const override;
MessageAuthenticationCode* clone() const override;
size_t output_length() const override { return 8; }
Key_Length_Specification key_spec() const override
{
return Key_Length_Specification(16);
}
private:
void add_data(const byte[], size_t) override;
void final_result(byte[]) override;
void key_schedule(const byte[], size_t) override;
const size_t m_C, m_D;
secure_vector<u64bit> m_V;
u64bit m_mbuf = 0;
size_t m_mbuf_pos = 0;
byte m_words = 0;
};
}
#endif
|