Electroneum
crypto.h File Reference
#include <cstddef>
#include <iostream>
#include <boost/optional.hpp>
#include <type_traits>
#include <boost/thread/mutex.hpp>
#include <boost/thread/lock_guard.hpp>
#include <boost/archive/iterators/binary_from_base64.hpp>
#include <boost/archive/iterators/base64_from_binary.hpp>
#include <boost/archive/iterators/transform_width.hpp>
#include <boost/algorithm/string.hpp>
#include <boost/algorithm/hex.hpp>
#include <vector>
#include <random>
#include "ed25519-donna/ed25519.h"
#include "common/pod-class.h"
#include "memwipe.h"
#include "mlocker.h"
#include "generic-ops.h"
#include "hex.h"
#include "span.h"
#include "hash.h"
#include "warnings.h"
#include "crypto-ops.h"
#include "random.h"
Include dependency graph for crypto.h:

Go to the source code of this file.

Classes

struct  crypto::ec_point_pair
 
struct  crypto::rs_comm
 
class  crypto::crypto_ops
 
struct  crypto::random_device
 

Namespaces

 crypto
 crypto namespace.
 

Typedefs

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

Functions

void crypto::generate_random_bytes_not_thread_safe (size_t n, void *result)
 
void crypto::hash_to_scalar (const void *data, size_t length, ec_scalar &res)
 
void crypto::random32_unbiased (unsigned char *bytes)
 
void crypto::random_scalar (ec_scalar &res)
 
size_t crypto::rs_comm_size (size_t pubs_count)
 
void crypto::hash_to_ec (const public_key &key, ge_p3 &res)
 
void crypto::hash_to_ec (const hash &h, ge_p3 &res)
 
void crypto::hash_to_point (const crypto::hash &h, crypto::ec_point &res)
 
void crypto::generate_random_bytes_thread_safe (size_t N, uint8_t *bytes)
 
void crypto::rand (size_t N, uint8_t *bytes)
 
template<typename T >
std::enable_if< std::is_pod< T >::value, T >::type crypto::rand ()
 
template<typename T >
std::enable_if< std::is_integral< T >::value, T >::type crypto::rand_range (T range_min, T range_max)
 
template<typename T >
std::enable_if< std::is_unsigned< T >::value, T >::type crypto::rand_idx (T sz)
 
secret_key crypto::generate_keys (public_key &pub, secret_key &sec, const secret_key &recovery_key=secret_key(), bool recover=false)
 
bool crypto::check_key (const public_key &key)
 
bool crypto::secret_key_to_public_key (const secret_key &sec, public_key &pub)
 
bool crypto::generate_key_derivation (const public_key &key1, const secret_key &key2, key_derivation &derivation)
 
bool crypto::derive_public_key (const key_derivation &derivation, std::size_t output_index, const public_key &base, public_key &derived_key)
 
void crypto::derivation_to_scalar (const key_derivation &derivation, size_t output_index, ec_scalar &res)
 
void crypto::derive_secret_key (const key_derivation &derivation, std::size_t output_index, const secret_key &base, secret_key &derived_key)
 
bool crypto::derive_subaddress_public_key (const public_key &out_key, const key_derivation &derivation, std::size_t output_index, public_key &result)
 
void crypto::generate_signature (const hash &prefix_hash, const public_key &pub, const secret_key &sec, signature &sig)
 
bool crypto::check_signature (const hash &prefix_hash, const public_key &pub, const signature &sig)
 
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)
 
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)
 
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)
 
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)
 
void crypto::generate_key_image (const public_key &pub, const secret_key &sec, key_image &image)
 
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)
 
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)
 
public_key crypto::addKeys (const public_key &A, const public_key &B)
 
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)
 
bool crypto::check_ring_signature (const hash &prefix_hash, const key_image &image, const std::vector< const public_key *> &pubs, const signature *sig)
 
std::ostream & crypto::operator<< (std::ostream &o, const crypto::public_key &v)
 
std::ostream & crypto::operator<< (std::ostream &o, const crypto::secret_key &v)
 
std::ostream & crypto::operator<< (std::ostream &o, const crypto::key_derivation &v)
 
std::ostream & crypto::operator<< (std::ostream &o, const crypto::key_image &v)
 
std::ostream & crypto::operator<< (std::ostream &o, const crypto::signature &v)
 
std::string crypto::sign_message (const std::string &message, const std::string &privateKey)
 
bool crypto::verify_signature (const std::string &message, const std::string &publicKey, const std::string &signature)
 
bool crypto::verify_signature (const std::string &message, std::vector< std::string > publicKey, const std::string &signature)
 
std::vector< std::string > crypto::create_ed25519_keypair ()
 
std::string crypto::base64_decode (const std::string &val)
 
std::string crypto::base64_encode (const std::string &val)
 

Variables

POD_CLASS crypto::ec_point
 
POD_CLASS crypto::ec_scalar
 
POD_CLASS crypto::public_key
 
POD_CLASS crypto::public_keyV
 
int crypto::rows
 
POD_CLASS crypto::secret_keyV
 
POD_CLASS crypto::public_keyM
 
std::vector< secret_keyV > crypto::column_vectors
 
POD_CLASS crypto::key_derivation
 
POD_CLASS crypto::key_image
 
POD_CLASS crypto::signature