#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); \
} \
}; \
}
crypto namespace.
Definition: crypto.cpp:58
Definition: blockchain_ancestry.cpp:73
◆ 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!=(expect< T > const &lhs, expect< U > const &rhs) noexcept(noexcept(lhs.equal(rhs)))
Definition: expect.h:422
bool operator==(expect< T > const &lhs, expect< U > const &rhs) noexcept(noexcept(lhs.equal(rhs)))
Definition: expect.h:401
◆ 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 *)
Definition: verify.c:3
◆ CRYPTO_MAKE_HASHABLE
| #define CRYPTO_MAKE_HASHABLE |
( |
|
type | ) |
|
Value:
CRYPTO_DEFINE_HASH_FUNCTIONS(type)
#define CRYPTO_MAKE_COMPARABLE(type)
Definition: generic-ops.h:39
◆ 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: generic-ops.h:49