Botan
1.11.15
|
00001 /* 00002 * SipHash 00003 * (C) 2014,2015 Jack Lloyd 00004 * 00005 * Botan is released under the Simplified BSD License (see license.txt) 00006 */ 00007 00008 #ifndef BOTAN_SIPHASH_H__ 00009 #define BOTAN_SIPHASH_H__ 00010 00011 #include <botan/mac.h> 00012 00013 namespace Botan { 00014 00015 class BOTAN_DLL SipHash : public MessageAuthenticationCode 00016 { 00017 public: 00018 SipHash(size_t c = 2, size_t d = 4) : m_C(c), m_D(d) {} 00019 00020 void clear(); 00021 std::string name() const; 00022 00023 MessageAuthenticationCode* clone() const; 00024 00025 size_t output_length() const { return 8; } 00026 00027 Key_Length_Specification key_spec() const 00028 { 00029 return Key_Length_Specification(16); 00030 } 00031 private: 00032 void add_data(const byte[], size_t); 00033 void final_result(byte[]); 00034 void key_schedule(const byte[], size_t); 00035 00036 const size_t m_C, m_D; 00037 secure_vector<u64bit> m_V; 00038 u64bit m_mbuf = 0; 00039 size_t m_mbuf_pos = 0; 00040 byte m_words = 0; 00041 }; 00042 00043 } 00044 00045 #endif