#include <cstddef>
#include <cstring>
#include <functional>
#include <sodium/crypto_verify_32.h>
Go to the source code of this file.
◆ CRYPTO_DEFINE_HASH_FUNCTIONS
| #define CRYPTO_DEFINE_HASH_FUNCTIONS |
( |
|
type | ) |
|
Value: static_assert(sizeof(std::size_t) <= sizeof(type), "Size of " #type " must be at least that of size_t"); \
inline std::size_t hash_value(const type &_v) { \
return reinterpret_cast<const std::size_t &>(_v); \
} \
} \
template<> \
struct hash<crypto::type> { \
std::size_t operator()(const crypto::type &_v) const { \
return reinterpret_cast<const std::size_t &>(_v); \
} \
}; \
}
Definition at line 60 of file generic-ops.h.
◆ CRYPTO_MAKE_COMPARABLE
| #define CRYPTO_MAKE_COMPARABLE |
( |
|
type | ) |
|
Value: inline
bool operator==(
const type &_v1,
const type &_v2) { \
return !memcmp(&_v1, &_v2, sizeof(_v1)); \
} \
inline
bool operator!=(
const type &_v1,
const type &_v2) { \
} \
}
bool operator==(const some_test_data &a, const some_test_data &b)
bool operator!=(const some_test_subdata &a, const some_test_subdata &b)
Definition at line 39 of file generic-ops.h.
◆ CRYPTO_MAKE_COMPARABLE_CONSTANT_TIME
| #define CRYPTO_MAKE_COMPARABLE_CONSTANT_TIME |
( |
|
type | ) |
|
Value: inline
bool operator==(
const type &_v1,
const type &_v2) { \
static_assert(sizeof(_v1) == 32, "constant time comparison is only implenmted for 32 bytes"); \
return
crypto_verify_32((
const unsigned char*)&_v1, (
const unsigned char*)&_v2) == 0; \
} \
inline
bool operator!=(
const type &_v1,
const type &_v2) { \
} \
}
int crypto_verify_32(const unsigned char *, const unsigned char *)
bool operator==(const some_test_data &a, const some_test_data &b)
bool operator!=(const some_test_subdata &a, const some_test_subdata &b)
Definition at line 49 of file generic-ops.h.
◆ CRYPTO_MAKE_HASHABLE
| #define CRYPTO_MAKE_HASHABLE |
( |
|
type | ) |
|
Value:CRYPTO_DEFINE_HASH_FUNCTIONS(type)
#define CRYPTO_MAKE_COMPARABLE(type)
Definition at line 76 of file generic-ops.h.
◆ CRYPTO_MAKE_HASHABLE_CONSTANT_TIME
| #define CRYPTO_MAKE_HASHABLE_CONSTANT_TIME |
( |
|
type | ) |
|
Value:CRYPTO_DEFINE_HASH_FUNCTIONS(type)
#define CRYPTO_MAKE_COMPARABLE_CONSTANT_TIME(type)
Definition at line 80 of file generic-ops.h.