Go to the documentation of this file.
35 #include <boost/optional.hpp>
36 #include <type_traits>
67 using secret_key = epee::mlocked<tools::scrubbed<ec_scalar>>;
70 std::vector<public_key> keys;
75 std::vector<secret_key> keys;
105 sizeof(
signature) == 64,
"Invalid structure size");
156 inline void rand(
size_t N, uint8_t *bytes) {
163 typename std::enable_if<std::is_pod<T>::value,
T>::type
rand() {
164 typename std::remove_cv<T>::type res;
182 typename std::enable_if<std::is_integral<T>::value,
T>::type
rand_range(
T range_min,
T range_max) {
184 std::uniform_int_distribution<T> dis(range_min, range_max);
191 typename std::enable_if<std::is_unsigned<T>::value,
T>::type
rand_idx(
T sz) {
192 return crypto::rand_range<T>(0, sz-1);
270 const public_key *
const *pubs, std::size_t pubs_count,
276 const public_key *
const *pubs, std::size_t pubs_count,
284 const std::vector<const public_key *> &pubs,
290 const std::vector<const public_key *> &pubs,
296 epee::to_hex::formatted(o, epee::as_byte_span(v));
return o;
299 epee::to_hex::formatted(o, epee::as_byte_span(v));
return o;
302 epee::to_hex::formatted(o, epee::as_byte_span(v));
return o;
305 epee::to_hex::formatted(o, epee::as_byte_span(v));
return o;
308 epee::to_hex::formatted(o, epee::as_byte_span(v));
return o;
bool secret_key_to_public_key(const secret_key &sec, public_key &pub)
Definition: crypto.h:209
POD_CLASS public_keyV
Definition: crypto.h:69
static void generate_ring_signature(const hash &, const key_image &, const public_key *const *, std::size_t, const secret_key &, std::size_t, signature *)
static void derive_secret_key(const key_derivation &, std::size_t, const secret_key &, secret_key &)
#define POD_CLASS
Definition: pod-class.h:43
bool check_tx_proof(const hash &prefix_hash, const public_key &R, const public_key &A, const boost::optional< public_key > &B, const public_key &D, const signature &sig, const int version)
Definition: crypto.h:256
POD_CLASS ec_point
Definition: crypto.h:55
const uint32_t T[512]
Definition: groestl_tables.h:36
static void generate_tx_proof_v1(const hash &, const public_key &, const public_key &, const boost::optional< public_key > &, const public_key &, const secret_key &, signature &)
Definition: crypto.cpp:343
static bool derive_public_key(const key_derivation &, std::size_t, const public_key &, public_key &)
void derive_secret_key(const key_derivation &derivation, std::size_t output_index, const secret_key &base, secret_key &derived_key)
Definition: crypto.h:229
bool check_ring_signature(const hash &prefix_hash, const key_image &image, const public_key *const *pubs, std::size_t pubs_count, const signature *sig)
Definition: crypto.h:275
void random32_unbiased(unsigned char *bytes)
Definition: crypto.cpp:123
list B
Definition: base.py:26
crypto namespace.
Definition: crypto.cpp:60
std::enable_if< std::is_unsigned< T >::value, T >::type rand_idx(T sz)
Definition: crypto.h:191
static void derivation_to_scalar(const key_derivation &derivation, size_t output_index, ec_scalar &res)
Definition: crypto.cpp:201
static secret_key generate_keys(public_key &pub, secret_key &sec, const secret_key &recovery_key=secret_key(), bool recover=false)
Definition: crypto.cpp:149
epee::mlocked< tools::scrubbed< ec_scalar > > secret_key
Definition: crypto.h:67
POD_CLASS key_derivation
Definition: crypto.h:83
static bool derive_subaddress_public_key(const public_key &, const key_derivation &, std::size_t, public_key &)
Definition: crypto.cpp:241
bool derive_subaddress_public_key(const public_key &out_key, const key_derivation &derivation, std::size_t output_index, public_key &result)
Definition: crypto.h:233
const crypto::secret_key null_skey
Definition: crypto.cpp:75
static bool check_signature(const hash &, const public_key &, const signature &)
Definition: crypto.cpp:315
#define CRYPTO_MAKE_COMPARABLE(type)
Definition: generic-ops.h:38
#define CRYPTO_MAKE_HASHABLE(type)
Definition: generic-ops.h:75
void generate_signature(const hash &prefix_hash, const public_key &pub, const secret_key &sec, signature &sig)
Definition: crypto.h:239
POD_CLASS secret_keyV
Definition: crypto.h:74
static bool generate_key_derivation(const public_key &, const secret_key &, key_derivation &)
Definition: crypto.cpp:186
crypto_ops(const crypto_ops &)
POD_CLASS ec_scalar
Definition: crypto.h:59
secret_key generate_keys(public_key &pub, secret_key &sec, const secret_key &recovery_key=secret_key(), bool recover=false)
Definition: crypto.h:197
bool generate_key_derivation(const public_key &key1, const secret_key &key2, key_derivation &derivation)
Definition: crypto.h:219
void generate_random_bytes_thread_safe(size_t N, uint8_t *bytes)
Definition: crypto.cpp:99
void generate_key_image(const public_key &pub, const secret_key &sec, key_image &image)
Definition: crypto.h:266
void rand(size_t N, uint8_t *bytes)
Definition: crypto.h:156
version
Supported socks variants.
Definition: socks.h:58
POD_CLASS public_keyM
Definition: crypto.h:79
std::enable_if< std::is_integral< T >::value, T >::type rand_range(T range_min, T range_max)
Definition: crypto.h:182
void generate_ring_signature(const hash &prefix_hash, const key_image &image, const public_key *const *pubs, std::size_t pubs_count, const secret_key &sec, std::size_t sec_index, signature *sig)
Definition: crypto.h:269
#define CRYPTO_MAKE_HASHABLE_CONSTANT_TIME(type)
Definition: generic-ops.h:79
void generate_tx_proof(const hash &prefix_hash, const public_key &R, const public_key &A, const boost::optional< public_key > &B, const public_key &D, const secret_key &r, signature &sig)
Definition: crypto.h:250
void hash_to_scalar(const void *data, size_t length, ec_scalar &res)
Definition: crypto.cpp:139
POD_CLASS signature
Definition: crypto.h:93
const crypto::public_key null_pkey
Definition: crypto.cpp:74
result_type operator()() const
Definition: crypto.h:176
static bool check_ring_signature(const hash &, const key_image &, const public_key *const *, std::size_t, const signature *)
std::vector< secret_keyV > column_vectors
Definition: crypto.h:82
std::ostream & operator<<(std::ostream &o, const crypto::public_key &v)
Definition: crypto.h:295
bool derive_public_key(const key_derivation &derivation, std::size_t output_index, const public_key &base, public_key &derived_key)
Definition: crypto.h:222
POD_CLASS public_key
Definition: crypto.h:61
void operator=(const crypto_ops &)
static void generate_tx_proof(const hash &, const public_key &, const public_key &, const boost::optional< public_key > &, const public_key &, const secret_key &, signature &)
Definition: crypto.cpp:419
static void generate_key_image(const public_key &, const secret_key &, key_image &)
Definition: crypto.cpp:617
uint64_t result_type
Definition: crypto.h:173
static bool check_key(const public_key &)
Definition: crypto.cpp:171
int rows
Definition: crypto.h:71
bool check_key(const public_key &key)
Definition: crypto.h:203
void add_extra_entropy_thread_safe(const void *ptr, size_t bytes)
Definition: crypto.cpp:105
void derivation_to_scalar(const key_derivation &derivation, size_t output_index, ec_scalar &res)
Definition: crypto.h:226
static void generate_signature(const hash &, const public_key &, const secret_key &, signature &)
Definition: crypto.cpp:286
POD_CLASS key_image
Definition: crypto.h:87
bool check_signature(const hash &prefix_hash, const public_key &pub, const signature &sig)
Definition: crypto.h:242
static constexpr result_type max()
Definition: crypto.h:175
static bool secret_key_to_public_key(const secret_key &, public_key &)
Definition: crypto.cpp:176
void generate_tx_proof_v1(const hash &prefix_hash, const public_key &R, const public_key &A, const boost::optional< public_key > &B, const public_key &D, const secret_key &r, signature &sig)
Definition: crypto.h:253
static constexpr result_type min()
Definition: crypto.h:174
static bool check_tx_proof(const hash &, const public_key &, const public_key &, const boost::optional< public_key > &, const public_key &, const signature &, const int)
Definition: crypto.cpp:504
POD_CLASS hash
Definition: hash.h:48