Electroneum
crypto Namespace Reference

crypto namespace. More...

Namespaces

 ElectrumWords
 Mnemonic seed word generation and wallet restoration helper functions.
 

Classes

struct  s_comm
 
struct  s_comm_2
 
struct  s_comm_3
 
struct  ec_point_pair
 
struct  rs_comm
 
class  crypto_ops
 
struct  random_device
 

Typedefs

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

Functions

void generate_random_bytes_thread_safe (size_t N, uint8_t *bytes)
 
void random32_unbiased (unsigned char *bytes)
 
void random_scalar (ec_scalar &res)
 
void hash_to_scalar (const void *data, size_t length, ec_scalar &res)
 
void hash_to_ec (const public_key &key, ge_p3 &res)
 
void hash_to_ec (const hash &h, ge_p3 &res)
 
size_t rs_comm_size (size_t pubs_count)
 
void rand (size_t N, uint8_t *bytes)
 
template<typename T >
std::enable_if< std::is_pod< T >::value, T >::type 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_input_signature (const hash prefix_hash, const uint32_t input_index, const secret_key sec_view, const secret_key sec_spend, signature &sig)
 
bool verify_input_signature (const hash &prefix_hash, const uint32_t input_index, const public_key pub_view, const public_key pub_spend, 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)
 
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)
 
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)
 
public_key addKeys (const public_key &A, const public_key &B)
 
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)
 
std::ostream & operator<< (std::ostream &o, const crypto::public_key &v)
 
std::ostream & operator<< (std::ostream &o, const crypto::secret_key &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::string sign_message (const std::string &message, const std::string &privateKey)
 
bool verify_signature (const std::string &message, const std::string &publicKey, const std::string &signature)
 
bool verify_signature (const std::string &message, std::vector< std::string > publicKey, const std::string &signature)
 
std::vector< std::string > create_ed25519_keypair ()
 
std::string base64_decode (const std::string &val)
 
std::string base64_encode (const std::string &val)
 
void cn_fast_hash (const void *data, std::size_t length, hash &hash)
 
hash cn_fast_hash (const void *data, std::size_t length)
 
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)
 
std::ostream & operator<< (std::ostream &o, const crypto::hash64 &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_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 hash
 
POD_CLASS hash8
 
POD_CLASS hash64
 

Detailed Description

crypto namespace.

Typedef Documentation

◆ secret_key

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

Definition at line 82 of file crypto.h.

Function Documentation

◆ addKeys()

public_key crypto::addKeys ( const public_key A,
const public_key B 
)
inline

Definition at line 337 of file crypto.h.

337  {
338  return crypto_ops::addKeys(A, B);
339  }
public_key addKeys(const public_key &A, const public_key &B)
Definition: crypto.h:337
Matcher< T > A()
Here is the caller graph for this function:

◆ base64_decode()

std::string crypto::base64_decode ( const std::string &  val)
inline

Definition at line 390 of file crypto.h.

390  {
391  using namespace boost::archive::iterators;
392  using It = transform_width<binary_from_base64<std::string::const_iterator>, 8, 6>;
393  return boost::algorithm::trim_right_copy_if(std::string(It(std::begin(val)), It(std::end(val))), [](char c) {
394  return c == '\0';
395  });
396  }
::std::string string
Definition: gtest-port.h:1097

◆ base64_encode()

std::string crypto::base64_encode ( const std::string &  val)
inline

Definition at line 398 of file crypto.h.

398  {
399  using namespace boost::archive::iterators;
400  using It = base64_from_binary<transform_width<std::string::const_iterator, 6, 8>>;
401  auto tmp = std::string(It(std::begin(val)), It(std::end(val)));
402  return tmp.append((3 - val.size() % 3) % 3, '=');
403  }

◆ check_key()

bool crypto::check_key ( const public_key key)
inline

Definition at line 254 of file crypto.h.

254  {
255  return crypto_ops::check_key(key);
256  }
const char * key
Definition: hmac_keccak.cpp:39
bool check_key(const public_key &key)
Definition: crypto.h:254
Here is the caller graph for this function:

◆ 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

Definition at line 331 of file crypto.h.

333  {
334  return crypto_ops::check_ring_signature(prefix_hash, image, pubs, pubs_count, sig);
335  }
bool check_ring_signature(const hash &prefix_hash, const key_image &image, const std::vector< const public_key * > &pubs, const signature *sig)
Definition: crypto.h:349
Here is the caller graph for this function:

◆ 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

Definition at line 349 of file crypto.h.

351  {
352  return check_ring_signature(prefix_hash, image, pubs.data(), pubs.size(), sig);
353  }
Here is the call graph for this function:

◆ check_signature()

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

Definition at line 293 of file crypto.h.

293  {
294  return crypto_ops::check_signature(prefix_hash, pub, sig);
295  }
bool check_signature(const hash &prefix_hash, const public_key &pub, const signature &sig)
Definition: crypto.h:293
Here is the caller graph for this function:

◆ 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 
)
inline

Definition at line 312 of file crypto.h.

312  {
313  return crypto_ops::check_tx_proof(prefix_hash, R, A, B, D, sig);
314  }
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)
Definition: crypto.h:312
Here is the caller graph for this function:

◆ cn_fast_hash() [1/2]

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

Definition at line 73 of file hash.h.

73  {
74  hash h;
75  cn_fast_hash(data, length, reinterpret_cast<char *>(&h));
76  return h;
77  }
void cn_fast_hash(const void *data, size_t length, char *hash)
POD_CLASS hash
Definition: hash.h:50
Here is the call graph for this function:

◆ cn_fast_hash() [2/2]

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

Definition at line 69 of file hash.h.

69  {
70  cn_fast_hash(data, length, reinterpret_cast<char *>(&hash));
71  }
Here is the caller graph for this function:

◆ 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

Definition at line 79 of file hash.h.

79  {
80  cn_slow_hash(data, length, reinterpret_cast<char *>(&hash), variant, 0/*prehashed*/, height);
81  }
uint64_t height
Definition: blockchain.cpp:91
void cn_slow_hash(const void *data, size_t length, char *hash, int variant, int prehashed, uint64_t height)
Here is the caller graph for this function:

◆ 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

Definition at line 83 of file hash.h.

83  {
84  cn_slow_hash(data, length, reinterpret_cast<char *>(&hash), variant, 1/*prehashed*/, height);
85  }
Here is the call graph for this function:

◆ create_ed25519_keypair()

std::vector<std::string> crypto::create_ed25519_keypair ( )
inline

Definition at line 386 of file crypto.h.

386  {
388  }
std::vector< std::string > create_ed25519_keypair()
Definition: crypto.h:386
Here is the caller graph for this function:

◆ derivation_to_scalar()

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

Definition at line 277 of file crypto.h.

277  {
279  }
const char * res
Definition: hmac_keccak.cpp:41
void derivation_to_scalar(const key_derivation &derivation, size_t output_index, ec_scalar &res)
Definition: crypto.h:277
Here is the caller graph for this function:

◆ 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

Definition at line 273 of file crypto.h.

274  {
275  return crypto_ops::derive_public_key(derivation, output_index, base, derived_key);
276  }
bool derive_public_key(const key_derivation &derivation, std::size_t output_index, const public_key &base, public_key &derived_key)
Definition: crypto.h:273
Here is the caller graph for this function:

◆ 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

Definition at line 280 of file crypto.h.

281  {
282  crypto_ops::derive_secret_key(derivation, output_index, base, derived_key);
283  }
void derive_secret_key(const key_derivation &derivation, std::size_t output_index, const secret_key &base, secret_key &derived_key)
Definition: crypto.h:280
Here is the caller graph for this function:

◆ 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

Definition at line 284 of file crypto.h.

284  {
285  return crypto_ops::derive_subaddress_public_key(out_key, derivation, output_index, result);
286  }
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:284
Here is the caller graph for this function:

◆ generate_input_signature()

void crypto::generate_input_signature ( const hash  prefix_hash,
const uint32_t  input_index,
const secret_key  sec_view,
const secret_key  sec_spend,
signature sig 
)
inline

Definition at line 297 of file crypto.h.

297  {
298  return crypto_ops::generate_input_signature(prefix_hash, input_index, sec_view, sec_spend, sig);
299  }
void generate_input_signature(const hash prefix_hash, const uint32_t input_index, const secret_key sec_view, const secret_key sec_spend, signature &sig)
Definition: crypto.h:297

◆ generate_key_derivation()

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

Definition at line 270 of file crypto.h.

270  {
271  return crypto_ops::generate_key_derivation(key1, key2, derivation);
272  }
bool generate_key_derivation(const public_key &key1, const secret_key &key2, key_derivation &derivation)
Definition: crypto.h:270
Here is the caller graph for this function:

◆ generate_key_image()

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

Definition at line 322 of file crypto.h.

322  {
323  crypto_ops::generate_key_image(pub, sec, image);
324  }
void generate_key_image(const public_key &pub, const secret_key &sec, key_image &image)
Definition: crypto.h:322
Here is the caller graph for this function:

◆ generate_keys()

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

Definition at line 248 of file crypto.h.

248  {
249  return crypto_ops::generate_keys(pub, sec, recovery_key, recover);
250  }
secret_key generate_keys(public_key &pub, secret_key &sec, const secret_key &recovery_key=secret_key(), bool recover=false)
Definition: crypto.h:248
Here is the caller graph for this function:

◆ generate_random_bytes_thread_safe()

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

Definition at line 91 of file crypto.cpp.

92  {
93  static boost::mutex random_lock;
94  boost::lock_guard<boost::mutex> lock(random_lock);
96  }
void generate_random_bytes_not_thread_safe(size_t n, void *result)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ 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

Definition at line 325 of file crypto.h.

328  {
329  crypto_ops::generate_ring_signature(prefix_hash, image, pubs, pubs_count, sec, sec_index, sig);
330  }
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)
Definition: crypto.h:343
Here is the caller graph for this function:

◆ 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

Definition at line 343 of file crypto.h.

346  {
347  generate_ring_signature(prefix_hash, image, pubs.data(), pubs.size(), sec, sec_index, sig);
348  }
Here is the call graph for this function:

◆ generate_signature()

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

Definition at line 290 of file crypto.h.

290  {
291  crypto_ops::generate_signature(prefix_hash, pub, sec, sig);
292  }
void generate_signature(const hash &prefix_hash, const public_key &pub, const secret_key &sec, signature &sig)
Definition: crypto.h:290
Here is the caller graph for this function:

◆ 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

Definition at line 309 of file crypto.h.

309  {
310  crypto_ops::generate_tx_proof(prefix_hash, R, A, B, D, r, sig);
311  }
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:309
Here is the caller graph for this function:

◆ hash_to_ec() [1/2]

void crypto::hash_to_ec ( const hash h,
ge_p3 res 
)

Definition at line 488 of file crypto.cpp.

488  {
489  ge_p2 point;
490  ge_p1p1 point2;
491  ge_fromfe_frombytes_vartime(&point, reinterpret_cast<const unsigned char *>(&h));
492  ge_mul8(&point2, &point);
493  ge_p1p1_to_p3(&res, &point2);
494  }
void ge_mul8(ge_p1p1 *, const ge_p2 *)
void ge_fromfe_frombytes_vartime(ge_p2 *, const unsigned char *)
#define ge_p1p1_to_p3
Definition: ge.h:63
Here is the call graph for this function:

◆ hash_to_ec() [2/2]

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

Definition at line 479 of file crypto.cpp.

479  {
480  hash h;
481  ge_p2 point;
482  ge_p1p1 point2;
483  cn_fast_hash(std::addressof(key), sizeof(public_key), h);
484  ge_fromfe_frombytes_vartime(&point, reinterpret_cast<const unsigned char *>(&h));
485  ge_mul8(&point2, &point);
486  ge_p1p1_to_p3(&res, &point2);
487  }
POD_CLASS public_key
Definition: crypto.h:76
Here is the call graph for this function:
Here is the caller graph for this function:

◆ hash_to_scalar()

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

Definition at line 126 of file crypto.cpp.

126  {
127  cn_fast_hash(data, length, reinterpret_cast<hash &>(res));
128  sc_reduce32(&res);
129  }
void sc_reduce32(unsigned char *)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ operator<<() [1/8]

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

Definition at line 91 of file hash.h.

91  {
93  }
span< const std::uint8_t > as_byte_span(const T &src) noexcept
Definition: span.h:153
static void formatted(std::ostream &out, const span< const std::uint8_t > src)
Append < + src + > as hex to out.
Definition: hex.cpp:76
Here is the call graph for this function:

◆ operator<<() [2/8]

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

Definition at line 97 of file hash.h.

97  {
99  }
Here is the call graph for this function:

◆ operator<<() [3/8]

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

Definition at line 94 of file hash.h.

94  {
96  }
Here is the call graph for this function:

◆ operator<<() [4/8]

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

Definition at line 361 of file crypto.h.

361  {
363  }
Here is the call graph for this function:

◆ operator<<() [5/8]

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

Definition at line 364 of file crypto.h.

364  {
366  }
Here is the call graph for this function:

◆ operator<<() [6/8]

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

Definition at line 355 of file crypto.h.

355  {
357  }
Here is the call graph for this function:

◆ operator<<() [7/8]

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

Definition at line 358 of file crypto.h.

358  {
360  }
Here is the call graph for this function:

◆ operator<<() [8/8]

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

Definition at line 367 of file crypto.h.

367  {
369  }
Here is the call graph for this function:

◆ rand() [1/2]

template<typename T >
std::enable_if<std::is_pod<T>::value, T>::type crypto::rand ( )

Definition at line 214 of file crypto.h.

214  {
215  typename std::remove_cv<T>::type res;
217  return res;
218  }
const uint32_t T[512]
void generate_random_bytes_thread_safe(size_t N, uint8_t *bytes)
Definition: crypto.cpp:91
unsigned char uint8_t
Definition: stdint.h:124
Here is the call graph for this function:

◆ rand() [2/2]

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

Definition at line 207 of file crypto.h.

207  {
209  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ rand_idx()

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

Definition at line 242 of file crypto.h.

242  {
243  return crypto::rand_range<T>(0, sz-1);
244  }
Here is the caller graph for this function:

◆ rand_range()

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

Definition at line 233 of file crypto.h.

233  {
235  std::uniform_int_distribution<T> dis(range_min, range_max);
236  return dis(rd);
237  }

◆ random32_unbiased()

void crypto::random32_unbiased ( unsigned char *  bytes)

Definition at line 110 of file crypto.cpp.

111  {
112  // l = 2^252 + 27742317777372353535851937790883648493.
113  // it fits 15 in 32 bytes
114  static const unsigned char limit[32] = { 0xe3, 0x6a, 0x67, 0x72, 0x8b, 0xce, 0x13, 0x29, 0x8f, 0x30, 0x82, 0x8c, 0x0b, 0xa4, 0x10, 0x39, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0 };
115  do
116  {
118  } while (!sc_isnonzero(bytes) && !less32(bytes, limit)); // should be good about 15/16 of the time
119  sc_reduce32(bytes);
120  }
int sc_isnonzero(const unsigned char *)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ random_scalar()

void crypto::random_scalar ( ec_scalar res)

Definition at line 122 of file crypto.cpp.

122  {
123  random32_unbiased((unsigned char*)res.data);
124  }
void random32_unbiased(unsigned char *bytes)
Definition: crypto.cpp:110
Here is the call graph for this function:
Here is the caller graph for this function:

◆ rs_comm_size()

size_t crypto::rs_comm_size ( size_t  pubs_count)

Definition at line 505 of file crypto.cpp.

505  {
506  return sizeof(rs_comm) + pubs_count * sizeof(ec_point_pair);
507  }

◆ secret_key_to_public_key()

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

Definition at line 260 of file crypto.h.

260  {
261  return crypto_ops::secret_key_to_public_key(sec, pub);
262  }
bool secret_key_to_public_key(const secret_key &sec, public_key &pub)
Definition: crypto.h:260
Here is the caller graph for this function:

◆ sign_message()

std::string crypto::sign_message ( const std::string &  message,
const std::string &  privateKey 
)
inline

Definition at line 374 of file crypto.h.

374  {
376  }
std::string privateKey
std::string message("Message requiring signing")
std::string sign_message(const std::string &message, const std::string &privateKey)
Definition: crypto.h:374
Here is the caller graph for this function:

◆ tree_hash()

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

Definition at line 87 of file hash.h.

87  {
88  tree_hash(reinterpret_cast<const char (*)[HASH_SIZE]>(hashes), count, reinterpret_cast<char *>(&root_hash));
89  }
@ HASH_SIZE
Definition: hash-ops.h:78
void tree_hash(const char(*hashes)[HASH_SIZE], size_t count, char *root_hash)
mdb_size_t count(MDB_cursor *cur)
struct hash_func hashes[]
Here is the call graph for this function:

◆ verify_input_signature()

bool crypto::verify_input_signature ( const hash prefix_hash,
const uint32_t  input_index,
const public_key  pub_view,
const public_key  pub_spend,
signature  sig 
)
inline

Definition at line 301 of file crypto.h.

301  {
302  return crypto_ops::verify_input_signature(prefix_hash, input_index, pub_view, pub_spend, sig);
303  }
bool verify_input_signature(const hash &prefix_hash, const uint32_t input_index, const public_key pub_view, const public_key pub_spend, signature sig)
Definition: crypto.h:301

◆ verify_signature() [1/2]

bool crypto::verify_signature ( const std::string &  message,
const std::string &  publicKey,
const std::string &  signature 
)
inline

Definition at line 378 of file crypto.h.

378  {
380  }
std::string publicKey
POD_CLASS signature
Definition: crypto.h:108
bool verify_signature(const std::string &message, std::vector< std::string > publicKey, const std::string &signature)
Definition: crypto.h:382
Here is the caller graph for this function:

◆ verify_signature() [2/2]

bool crypto::verify_signature ( const std::string &  message,
std::vector< std::string >  publicKey,
const std::string &  signature 
)
inline

Definition at line 382 of file crypto.h.

382  {
384  }

Variable Documentation

◆ column_vectors

std::vector<secret_keyV> crypto::column_vectors

Definition at line 97 of file crypto.h.

◆ ec_point

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

Definition at line 70 of file crypto.h.

◆ ec_scalar

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

Definition at line 74 of file crypto.h.

◆ hash

POD_CLASS crypto::hash
Initial value:
{
char data[HASH_SIZE]

Definition at line 50 of file hash.h.

◆ hash64

POD_CLASS crypto::hash64
Initial value:
{
char data[64]

Definition at line 56 of file hash.h.

◆ hash8

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

Definition at line 53 of file hash.h.

◆ key_derivation

POD_CLASS crypto::key_derivation

Definition at line 100 of file crypto.h.

◆ key_image

POD_CLASS crypto::key_image

Definition at line 104 of file crypto.h.

◆ null_pkey

const crypto::public_key crypto::null_pkey = crypto::public_key{}

Definition at line 72 of file crypto.cpp.

◆ null_skey

const crypto::secret_key crypto::null_skey = crypto::secret_key{}

Definition at line 73 of file crypto.cpp.

◆ public_key

POD_CLASS crypto::public_key

Definition at line 78 of file crypto.h.

◆ public_keyM

POD_CLASS crypto::public_keyM
Initial value:
{
int cols

Definition at line 94 of file crypto.h.

◆ public_keyV

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

Definition at line 84 of file crypto.h.

◆ rows

int crypto::rows

Definition at line 86 of file crypto.h.

◆ secret_keyV

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

Definition at line 89 of file crypto.h.

◆ signature

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

Definition at line 108 of file crypto.h.