Monero
Loading...
Searching...
No Matches
Namespaces | Classes | Typedefs | Functions | Variables
crypto Namespace Reference

crypto namespace. More...

Namespaces

namespace  ElectrumWords
 Mnemonic seed word generation and wallet restoration helper functions.
 
namespace  wallet
 

Classes

class  crypto_ops
 
struct  ec_point_pair
 
struct  random_device
 
struct  random_poisson_duration
 Generate poisson distributed values in discrete D time units. More...
 
struct  rs_comm
 
struct  s_comm
 
struct  s_comm_2
 
struct  s_comm_2_v1
 
struct  secret_key_explicit_print_ref
 

Typedefs

using secret_key = epee::mlocked<tools::scrubbed<ec_scalar>>
 
using random_poisson_seconds = random_poisson_duration<std::chrono::seconds>
 Generate random durations with 1 second precision.
 
using random_poisson_subseconds
 Generate random duration with 1/4 second precision.
 

Functions

static unsigned char * operator& (ec_point &point)
 
static const unsigned char * operator& (const ec_point &point)
 
static unsigned char * operator& (ec_scalar &scalar)
 
static const unsigned char * operator& (const ec_scalar &scalar)
 
boost::mutex & get_random_lock ()
 
void generate_random_bytes_thread_safe (size_t N, uint8_t *bytes)
 
void add_extra_entropy_thread_safe (const void *ptr, size_t bytes)
 
static bool less32 (const unsigned char *k0, const unsigned char *k1)
 
void random32_unbiased (unsigned char *bytes)
 
static void random_scalar (ec_scalar &res)
 
void hash_to_scalar (const void *data, size_t length, ec_scalar &res)
 
static void hash_to_ec (const public_key &key, ge_p3 &res)
 
static POP_WARNINGS size_t rs_comm_size (size_t pubs_count)
 
 public_key_memsafe (const public_key &original)
 
void rand (size_t N, uint8_t *bytes)
 
template<typename T >
T rand ()
 
template<typename T >
std::enable_if< std::is_integral< T >::value, T >::type rand_range (T range_min, T range_max)
 
template<typename T >
std::enable_if< std::is_unsigned< T >::value, T >::type rand_idx (T sz)
 
secret_key generate_keys (public_key &pub, secret_key &sec, const secret_key &recovery_key=secret_key(), bool recover=false)
 
bool check_key (const public_key &key)
 
bool secret_key_to_public_key (const secret_key &sec, public_key &pub)
 
bool generate_key_derivation (const public_key &key1, const secret_key &key2, key_derivation &derivation)
 
bool derive_public_key (const key_derivation &derivation, std::size_t output_index, const public_key &base, public_key &derived_key)
 
void derivation_to_scalar (const key_derivation &derivation, size_t output_index, ec_scalar &res)
 
void derive_secret_key (const key_derivation &derivation, std::size_t output_index, const secret_key &base, secret_key &derived_key)
 
bool derive_subaddress_public_key (const public_key &out_key, const key_derivation &derivation, std::size_t output_index, public_key &result)
 
void generate_signature (const hash &prefix_hash, const public_key &pub, const secret_key &sec, signature &sig)
 
bool check_signature (const hash &prefix_hash, const public_key &pub, const signature &sig)
 
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)
 
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)
 
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)
 
void generate_key_image (const public_key &pub, const secret_key &sec, key_image &image)
 
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)
 
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)
 
void generate_ring_signature (const hash &prefix_hash, const key_image &image, const std::vector< const public_key * > &pubs, const secret_key &sec, std::size_t sec_index, signature *sig)
 
bool check_ring_signature (const hash &prefix_hash, const key_image &image, const std::vector< const public_key * > &pubs, const signature *sig)
 
void derive_view_tag (const key_derivation &derivation, std::size_t output_index, view_tag &vt)
 
std::ostream & operator<< (std::ostream &o, const crypto::public_key &v)
 
std::ostream & operator<< (std::ostream &o, const secret_key_explicit_print_ref v)
 
std::ostream & operator<< (std::ostream &o, const crypto::key_derivation &v)
 
std::ostream & operator<< (std::ostream &o, const crypto::key_image &v)
 
std::ostream & operator<< (std::ostream &o, const crypto::signature &v)
 
std::ostream & operator<< (std::ostream &o, const crypto::view_tag &v)
 
bool operator< (const public_key &p1, const public_key &p2)
 
bool operator> (const public_key &p1, const public_key &p2)
 
void cn_fast_hash (const void *data, std::size_t length, hash &hash)
 
hash cn_fast_hash (const void *data, std::size_t length)
 
static constexpr void cn_variant1_check (const std::size_t length, const int variant)
 
void cn_slow_hash (const void *data, std::size_t length, hash &hash, int variant=0, uint64_t height=0)
 
void cn_slow_hash_prehashed (const void *data, std::size_t length, hash &hash, int variant=0, uint64_t height=0)
 
void tree_hash (const hash *hashes, std::size_t count, hash &root_hash)
 
std::ostream & operator<< (std::ostream &o, const crypto::hash &v)
 
std::ostream & operator<< (std::ostream &o, const crypto::hash8 &v)
 

Variables

const crypto::public_key null_pkey = crypto::public_key{}
 
const crypto::secret_key null_skey = crypto::secret_key{}
 
POD_CLASS ec_point
 
POD_CLASS ec_scalar
 
POD_CLASS public_key
 
POD_CLASS public_key_memsafe
 
POD_CLASS public_keyV
 
int rows
 
POD_CLASS secret_keyV
 
POD_CLASS public_keyM
 
std::vector< secret_keyVcolumn_vectors
 
POD_CLASS key_derivation
 
POD_CLASS key_image
 
POD_CLASS signature
 
POD_CLASS view_tag
 
POD_CLASS hash
 
POD_CLASS hash8
 
static constexpr crypto::hash null_hash = {}
 
static constexpr crypto::hash8 null_hash8 = {}
 

Detailed Description

crypto namespace.

Typedef Documentation

◆ random_poisson_seconds

Generate random durations with 1 second precision.

◆ random_poisson_subseconds

Initial value:
random_poisson_duration<std::chrono::duration<std::chrono::milliseconds::rep, std::ratio<1, 4>>>

Generate random duration with 1/4 second precision.

◆ secret_key

using crypto::secret_key = epee::mlocked<tools::scrubbed<ec_scalar>>

Function Documentation

◆ add_extra_entropy_thread_safe()

void crypto::add_extra_entropy_thread_safe ( const void * ptr,
size_t bytes )

◆ check_key()

bool crypto::check_key ( const public_key & key)
inline

◆ check_ring_signature() [1/2]

bool crypto::check_ring_signature ( const hash & prefix_hash,
const key_image & image,
const public_key *const * pubs,
std::size_t pubs_count,
const signature * sig )
inline

◆ check_ring_signature() [2/2]

bool crypto::check_ring_signature ( const hash & prefix_hash,
const key_image & image,
const std::vector< const public_key * > & pubs,
const signature * sig )
inline

◆ check_signature()

bool crypto::check_signature ( const hash & prefix_hash,
const public_key & pub,
const signature & sig )
inline

◆ check_tx_proof()

bool crypto::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 )
inline

◆ cn_fast_hash() [1/2]

hash crypto::cn_fast_hash ( const void * data,
std::size_t length )
inline

◆ cn_fast_hash() [2/2]

void crypto::cn_fast_hash ( const void * data,
std::size_t length,
hash & hash )
inline

◆ cn_slow_hash()

void crypto::cn_slow_hash ( const void * data,
std::size_t length,
hash & hash,
int variant = 0,
uint64_t height = 0 )
inline

◆ cn_slow_hash_prehashed()

void crypto::cn_slow_hash_prehashed ( const void * data,
std::size_t length,
hash & hash,
int variant = 0,
uint64_t height = 0 )
inline

◆ cn_variant1_check()

static constexpr void crypto::cn_variant1_check ( const std::size_t length,
const int variant )
staticconstexpr

◆ derivation_to_scalar()

void crypto::derivation_to_scalar ( const key_derivation & derivation,
size_t output_index,
ec_scalar & res )
inline

◆ derive_public_key()

bool crypto::derive_public_key ( const key_derivation & derivation,
std::size_t output_index,
const public_key & base,
public_key & derived_key )
inline

◆ derive_secret_key()

void crypto::derive_secret_key ( const key_derivation & derivation,
std::size_t output_index,
const secret_key & base,
secret_key & derived_key )
inline

◆ derive_subaddress_public_key()

bool crypto::derive_subaddress_public_key ( const public_key & out_key,
const key_derivation & derivation,
std::size_t output_index,
public_key & result )
inline

◆ derive_view_tag()

void crypto::derive_view_tag ( const key_derivation & derivation,
std::size_t output_index,
view_tag & vt )
inline

◆ generate_key_derivation()

bool crypto::generate_key_derivation ( const public_key & key1,
const secret_key & key2,
key_derivation & derivation )
inline

◆ generate_key_image()

void crypto::generate_key_image ( const public_key & pub,
const secret_key & sec,
key_image & image )
inline

◆ generate_keys()

secret_key crypto::generate_keys ( public_key & pub,
secret_key & sec,
const secret_key & recovery_key = secret_key(),
bool recover = false )
inline

◆ generate_random_bytes_thread_safe()

void crypto::generate_random_bytes_thread_safe ( size_t N,
uint8_t * bytes )

◆ generate_ring_signature() [1/2]

void crypto::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 )
inline

◆ generate_ring_signature() [2/2]

void crypto::generate_ring_signature ( const hash & prefix_hash,
const key_image & image,
const std::vector< const public_key * > & pubs,
const secret_key & sec,
std::size_t sec_index,
signature * sig )
inline

◆ generate_signature()

void crypto::generate_signature ( const hash & prefix_hash,
const public_key & pub,
const secret_key & sec,
signature & sig )
inline

◆ generate_tx_proof()

void crypto::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 )
inline

◆ generate_tx_proof_v1()

void crypto::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 )
inline

◆ get_random_lock()

boost::mutex & crypto::get_random_lock ( )

◆ hash_to_ec()

static void crypto::hash_to_ec ( const public_key & key,
ge_p3 & res )
static

◆ hash_to_scalar()

void crypto::hash_to_scalar ( const void * data,
size_t length,
ec_scalar & res )

◆ less32()

static bool crypto::less32 ( const unsigned char * k0,
const unsigned char * k1 )
inlinestatic

◆ operator&() [1/4]

static const unsigned char * crypto::operator& ( const ec_point & point)
inlinestatic

◆ operator&() [2/4]

static const unsigned char * crypto::operator& ( const ec_scalar & scalar)
inlinestatic

◆ operator&() [3/4]

static unsigned char * crypto::operator& ( ec_point & point)
inlinestatic

◆ operator&() [4/4]

static unsigned char * crypto::operator& ( ec_scalar & scalar)
inlinestatic

◆ operator<()

bool crypto::operator< ( const public_key & p1,
const public_key & p2 )
inline

◆ operator<<() [1/8]

std::ostream & crypto::operator<< ( std::ostream & o,
const crypto::hash & v )
inline

◆ operator<<() [2/8]

std::ostream & crypto::operator<< ( std::ostream & o,
const crypto::hash8 & v )
inline

◆ operator<<() [3/8]

std::ostream & crypto::operator<< ( std::ostream & o,
const crypto::key_derivation & v )
inline

◆ operator<<() [4/8]

std::ostream & crypto::operator<< ( std::ostream & o,
const crypto::key_image & v )
inline

◆ operator<<() [5/8]

std::ostream & crypto::operator<< ( std::ostream & o,
const crypto::public_key & v )
inline

◆ operator<<() [6/8]

std::ostream & crypto::operator<< ( std::ostream & o,
const crypto::signature & v )
inline

◆ operator<<() [7/8]

std::ostream & crypto::operator<< ( std::ostream & o,
const crypto::view_tag & v )
inline

◆ operator<<() [8/8]

std::ostream & crypto::operator<< ( std::ostream & o,
const secret_key_explicit_print_ref v )
inline

◆ operator>()

bool crypto::operator> ( const public_key & p1,
const public_key & p2 )
inline

◆ public_key_memsafe()

crypto::public_key_memsafe ( const public_key & original)

◆ rand() [1/2]

template<typename T >
T crypto::rand ( )

◆ rand() [2/2]

void crypto::rand ( size_t N,
uint8_t * bytes )
inline

◆ rand_idx()

template<typename T >
std::enable_if< std::is_unsigned< T >::value, T >::type crypto::rand_idx ( T sz)

◆ rand_range()

template<typename T >
std::enable_if< std::is_integral< T >::value, T >::type crypto::rand_range ( T range_min,
T range_max )

◆ random32_unbiased()

void crypto::random32_unbiased ( unsigned char * bytes)

◆ random_scalar()

static void crypto::random_scalar ( ec_scalar & res)
inlinestatic

◆ rs_comm_size()

static POP_WARNINGS size_t crypto::rs_comm_size ( size_t pubs_count)
inlinestatic

◆ secret_key_to_public_key()

bool crypto::secret_key_to_public_key ( const secret_key & sec,
public_key & pub )
inline

◆ tree_hash()

void crypto::tree_hash ( const hash * hashes,
std::size_t count,
hash & root_hash )
inline

Variable Documentation

◆ column_vectors

std::vector<secret_keyV> crypto::column_vectors

◆ ec_point

POD_CLASS crypto::ec_point
Initial value:
{
char data[32]
std::string data
Definition base58.cpp:37

◆ ec_scalar

POD_CLASS crypto::ec_scalar
Initial value:
{
char data[32]

◆ hash

POD_CLASS crypto::hash
Initial value:
{
#define HASH_SIZE
Definition hmac-keccak.c:33

◆ hash8

POD_CLASS crypto::hash8
Initial value:
{
char data[8]

◆ key_derivation

POD_CLASS crypto::key_derivation

◆ key_image

POD_CLASS crypto::key_image

◆ null_hash

constexpr crypto::hash crypto::null_hash = {}
staticconstexpr

◆ null_hash8

constexpr crypto::hash8 crypto::null_hash8 = {}
staticconstexpr

◆ null_pkey

◆ null_skey

◆ public_key

POD_CLASS crypto::public_key

◆ public_key_memsafe

POD_CLASS crypto::public_key_memsafe

◆ public_keyM

POD_CLASS crypto::public_keyM
Initial value:
{
int cols

◆ public_keyV

POD_CLASS crypto::public_keyV
Initial value:
{
std::vector<public_key> keys

◆ rows

int crypto::rows

◆ secret_keyV

POD_CLASS crypto::secret_keyV
Initial value:
{
std::vector<secret_key> keys

◆ signature

POD_CLASS crypto::signature
Initial value:
{
ec_scalar c, r
POD_CLASS ec_scalar
Definition crypto.h:59

◆ view_tag

POD_CLASS crypto::view_tag
Initial value:
{
char data