27 #ifndef CRYPTOPP_SIPHASH_H 28 #define CRYPTOPP_SIPHASH_H 36 template <
bool T_128bit>
52 template <
unsigned int C,
unsigned int D,
bool T_128bit>
77 {
return GetAlignmentOf<word64>();}
79 virtual void Update(
const byte *input,
size_t length);
140 template <
unsigned int C=2,
unsigned int D=4,
bool T_128bit=false>
154 template <
unsigned int C,
unsigned int D,
bool T_128bit>
164 m_idx += head; input += head; length -= head;
170 for (
unsigned int i = 0; i < C; ++i)
184 for (
unsigned int i = 0; i < C; ++i)
195 size_t tail = length % 8;
203 template <
unsigned int C,
unsigned int D,
bool T_128bit>
235 for (
unsigned int i=0; i<C; i++)
245 for (
unsigned int i=0; i<D; i++)
254 for (
unsigned int i = 0; i<D; ++i)
257 m_b[1] = m_v[0] ^ m_v[1] ^ m_v[2] ^ m_v[3];
265 template <
unsigned int C,
unsigned int D,
bool T_128bit>
282 template <
unsigned int C,
unsigned int D,
bool T_128bit>
306 #endif // CRYPTOPP_SIPHASH_H SipHash message authentication code information.
Interface for message authentication codes.
Inherited by keyed algorithms with fixed key length.
SipHash message authentication code base class.
virtual unsigned int OptimalBlockSize() const
Provides the input block size most efficient for this hash.
Utility functions for the Crypto++ library.
#define CRYPTOPP_STATIC_CONSTEXPR
SipHash message authentication code.
virtual unsigned int DigestSize() const
Provides the digest size of the hash.
T rotlFixed(T x, unsigned int y)
Performs a left rotate.
virtual size_t MinKeyLength() const
Returns smallest valid key length.
#define NAMESPACE_BEGIN(x)
Abstract base classes that provide a uniform interface to this library.
void memcpy_s(void *dest, size_t sizeInBytes, const void *src, size_t count)
Bounds checking replacement for memcpy()
virtual void Update(const byte *input, size_t length)
Updates a hash with additional input.
FixedSizeSecBlock< byte, 8 > m_acc
The object does not use an IV.
FixedSizeSecBlock< word64, 2 > m_k
static std::string StaticAlgorithmName()
virtual unsigned int OptimalDataAlignment() const
Provides input and output data alignment for optimal performance.
byte order is little-endian
Classes and functions for secure memory allocations.
SipHash(const byte *key, unsigned int length)
Create a SipHash.
CRYPTOPP_STATIC_CONSTEXPR const char * StaticAlgorithmName()
virtual size_t GetValidKeyLength(size_t keylength) const
Returns a valid key length for the algorithm.
virtual unsigned int IVSize() const
Returns length of the IV accepted by this object.
T ConditionalByteReverse(ByteOrder order, T value)
Reverses bytes in a value depending upon endianness.
unsigned long long word64
#define CRYPTOPP_CONSTANT(x)
virtual void Restart()
Restart the hash.
FixedSizeSecBlock< word64, 4 > m_v
const T & STDMIN(const T &a, const T &b)
Replacement function for std::min.
#define CRYPTOPP_ASSERT(exp)
const NameValuePairs & g_nullNameValuePairs
An empty set of name-value pairs.
virtual size_t DefaultKeyLength() const
Returns default key length.
virtual size_t MaxKeyLength() const
Returns largest valid key length.
iterator begin()
Provides an iterator pointing to the first element in the memory block.
IV_Requirement
Secure IVs requirements as enumerated values.
void * memcpy(void *a, const void *b, size_t c)
#define CRYPTOPP_UNUSED(x)
FixedSizeSecBlock< word64, 2 > m_b
std::string IntToString(T value, unsigned int base=10)
Converts a value to a string.
SipHash()
Create a SipHash.
virtual void UncheckedSetKey(const byte *key, unsigned int length, const NameValuePairs ¶ms)
Sets the key for this object without performing parameter validation.
virtual IV_Requirement IVRequirement() const
Minimal requirement for secure IVs.
virtual void TruncatedFinal(byte *digest, size_t digestSize)
Computes the hash of the current message.
Interface for retrieving values given their names.