Electroneum
crypto.h
Go to the documentation of this file.
1 // Copyrights(c) 2017-2020, The Electroneum Project
2 // Copyrights(c) 2014-2019, The Monero Project
3 //
4 // All rights reserved.
5 //
6 // Redistribution and use in source and binary forms, with or without modification, are
7 // permitted provided that the following conditions are met:
8 //
9 // 1. Redistributions of source code must retain the above copyright notice, this list of
10 // conditions and the following disclaimer.
11 //
12 // 2. Redistributions in binary form must reproduce the above copyright notice, this list
13 // of conditions and the following disclaimer in the documentation and/or other
14 // materials provided with the distribution.
15 //
16 // 3. Neither the name of the copyright holder nor the names of its contributors may be
17 // used to endorse or promote products derived from this software without specific
18 // prior written permission.
19 //
20 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
21 // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
22 // MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
23 // THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
25 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
27 // STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
28 // THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 //
30 // Parts of this file are originally copyright (c) 2012-2013 The Cryptonote developers
31 
32 #pragma once
33 
34 #include <cstddef>
35 #include <iostream>
36 #include <boost/optional.hpp>
37 #include <type_traits>
38 #include <boost/thread/mutex.hpp>
39 #include <boost/thread/lock_guard.hpp>
40 #include <boost/archive/iterators/binary_from_base64.hpp>
41 #include <boost/archive/iterators/base64_from_binary.hpp>
42 #include <boost/archive/iterators/transform_width.hpp>
43 #include <boost/algorithm/string.hpp>
44 #include <boost/algorithm/hex.hpp>
45 #include <vector>
46 #include <random>
47 
48 #include "ed25519-donna/ed25519.h"
49 
50 #include "common/pod-class.h"
51 #include "memwipe.h"
52 #include "mlocker.h"
53 #include "generic-ops.h"
54 #include "hex.h"
55 #include "span.h"
56 #include "hash.h"
57 #include "warnings.h"
58 
59 extern "C" {
60 #include "crypto-ops.h"
61 }
62 
63 namespace crypto {
64 
65  extern "C" {
66 #include "random.h"
67  }
68 
69 #pragma pack(push, 1)
71  char data[32];
72  };
73 
75  char data[32];
76  };
77 
79  friend class crypto_ops;
80  };
81 
82  using secret_key = epee::mlocked<tools::scrubbed<ec_scalar>>;
83 
85  std::vector<public_key> keys;
86  int rows;
87  };
88 
90  std::vector<secret_key> keys;
91  int rows;
92  };
93 
95  int cols;
96  int rows;
97  std::vector<secret_keyV> column_vectors;
98  };
99 
101  friend class crypto_ops;
102  };
103 
105  friend class crypto_ops;
106  };
107 
109  ec_scalar c, r;
110  friend class crypto_ops;
111  };
112 #pragma pack(pop)
113 
114  void hash_to_scalar(const void *data, size_t length, ec_scalar &res);
115  void random32_unbiased(unsigned char *bytes);
116  void random_scalar(ec_scalar &res);
117  size_t rs_comm_size(size_t pubs_count);
119  DISABLE_VS_WARNINGS(4200)
120  struct ec_point_pair {
122  };
123  struct rs_comm {
125  struct ec_point_pair ab[];
126  };
127  POP_WARNINGS
128 
129  void hash_to_ec(const public_key &key, ge_p3 &res);
130 
131  static_assert(sizeof(ec_point) == 32 && sizeof(ec_scalar) == 32 &&
132  sizeof(public_key) == 32 && sizeof(secret_key) == 32 &&
133  sizeof(key_derivation) == 32 && sizeof(key_image) == 32 &&
134  sizeof(signature) == 64, "Invalid structure size");
135 
136  class crypto_ops {
139  void operator=(const crypto_ops &);
141 
142  static secret_key generate_keys(public_key &pub, secret_key &sec, const secret_key& recovery_key = secret_key(), bool recover = false);
143  friend secret_key generate_keys(public_key &pub, secret_key &sec, const secret_key& recovery_key, bool recover);
144  static bool check_key(const public_key &);
145  friend bool check_key(const public_key &);
146  static bool secret_key_to_public_key(const secret_key &, public_key &);
147  friend bool secret_key_to_public_key(const secret_key &, public_key &);
148  static bool generate_key_derivation(const public_key &, const secret_key &, key_derivation &);
149  friend bool generate_key_derivation(const public_key &, const secret_key &, key_derivation &);
150  static void derivation_to_scalar(const key_derivation &derivation, size_t output_index, ec_scalar &res);
151  friend void derivation_to_scalar(const key_derivation &derivation, size_t output_index, ec_scalar &res);
152  static bool derive_public_key(const key_derivation &, std::size_t, const public_key &, public_key &);
153  friend bool derive_public_key(const key_derivation &, std::size_t, const public_key &, public_key &);
154  static void derive_secret_key(const key_derivation &, std::size_t, const secret_key &, secret_key &);
155  friend void derive_secret_key(const key_derivation &, std::size_t, const secret_key &, secret_key &);
156  static bool derive_subaddress_public_key(const public_key &, const key_derivation &, std::size_t, public_key &);
157  friend bool derive_subaddress_public_key(const public_key &, const key_derivation &, std::size_t, public_key &);
158  static void generate_signature(const hash &, const public_key &, const secret_key &, signature &);
159  friend void generate_signature(const hash &, const public_key &, const secret_key &, signature &);
160  static bool check_signature(const hash &, const public_key &, const signature &);
161  friend bool check_signature(const hash &, const public_key &, const signature &);
162  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 &);
163  friend void generate_tx_proof(const hash &, const public_key &, const public_key &, const boost::optional<public_key> &, const public_key &, const secret_key &, signature &);
164  static bool check_tx_proof(const hash &, const public_key &, const public_key &, const boost::optional<public_key> &, const public_key &, const signature &);
165  friend bool check_tx_proof(const hash &, const public_key &, const public_key &, const boost::optional<public_key> &, const public_key &, const signature &);
166  static void generate_key_image(const public_key &, const secret_key &, key_image &);
167  friend void generate_key_image(const public_key &, const secret_key &, key_image &);
168  static void generate_ring_signature(const hash &, const key_image &,
169  const public_key *const *, std::size_t, const secret_key &, std::size_t, signature *);
170  friend void generate_ring_signature(const hash &, const key_image &,
171  const public_key *const *, std::size_t, const secret_key &, std::size_t, signature *);
172  static bool check_ring_signature(const hash &, const key_image &,
173  const public_key *const *, std::size_t, const signature *);
174  friend bool check_ring_signature(const hash &, const key_image &,
175  const public_key *const *, std::size_t, const signature *);
176 
177  static std::string sign_message(const std::string &message, const std::string &privateKey);
178  friend std::string sign_message(const std::string &message, const std::string &privateKey);
179  static bool verify_signature(const std::string &message, const std::string &publicKey, const std::string &signature);
180  friend bool verify_signature(const std::string &message, const std::string &publicKey, const std::string &signature);
181  static bool verify_signature(const std::string &message, std::vector<std::string> publicKey, const std::string &signature);
182  friend bool verify_signature(const std::string &message, std::vector<std::string> publicKey, const std::string &signature);
183 
184  static std::vector<std::string> create_ed25519_keypair();
185  friend std::vector<std::string> create_ed25519_keypair();
186 
187  static std::string base64_decode(std::string val);
188  friend std::string base64_decode(std::string val);
189  static std::string base64_encode(std::string val);
190  friend std::string base64_encode(std::string val);
191  };
192 
193  void generate_random_bytes_thread_safe(size_t N, uint8_t *bytes);
194 
195  /* Generate N random bytes
196  */
197  inline void rand(size_t N, uint8_t *bytes) {
199  }
200 
201  /* Generate a value filled with random bytes.
202  */
203  template<typename T>
204  typename std::enable_if<std::is_pod<T>::value, T>::type rand() {
205  typename std::remove_cv<T>::type res;
206  generate_random_bytes_thread_safe(sizeof(T), (uint8_t*)&res);
207  return res;
208  }
209 
210  /* UniformRandomBitGenerator using crypto::rand<uint64_t>()
211  */
213  {
214  typedef uint64_t result_type;
215  static constexpr result_type min() { return 0; }
216  static constexpr result_type max() { return result_type(-1); }
217  result_type operator()() const { return crypto::rand<result_type>(); }
218  };
219 
220  /* Generate a random value between range_min and range_max
221  */
222  template<typename T>
223  typename std::enable_if<std::is_integral<T>::value, T>::type rand_range(T range_min, T range_max) {
225  std::uniform_int_distribution<T> dis(range_min, range_max);
226  return dis(rd);
227  }
228 
229  /* Generate a random index between 0 and sz-1
230  */
231  template<typename T>
232  typename std::enable_if<std::is_unsigned<T>::value, T>::type rand_idx(T sz) {
233  return crypto::rand_range<T>(0, sz-1);
234  }
235 
236  /* Generate a new key pair
237  */
238  inline secret_key generate_keys(public_key &pub, secret_key &sec, const secret_key& recovery_key = secret_key(), bool recover = false) {
239  return crypto_ops::generate_keys(pub, sec, recovery_key, recover);
240  }
241 
242  /* Check a public key. Returns true if it is valid, false otherwise.
243  */
244  inline bool check_key(const public_key &key) {
245  return crypto_ops::check_key(key);
246  }
247 
248  /* Checks a private key and computes the corresponding public key.
249  */
250  inline bool secret_key_to_public_key(const secret_key &sec, public_key &pub) {
251  return crypto_ops::secret_key_to_public_key(sec, pub);
252  }
253 
254  /* To generate an ephemeral key used to send money to:
255  * * The sender generates a new key pair, which becomes the transaction key. The public transaction key is included in "extra" field.
256  * * Both the sender and the receiver generate key derivation from the transaction key, the receivers' "view" key and the output index.
257  * * The sender uses key derivation and the receivers' "spend" key to derive an ephemeral public key.
258  * * The receiver can either derive the public key (to check that the transaction is addressed to him) or the private key (to spend the money).
259  */
260  inline bool generate_key_derivation(const public_key &key1, const secret_key &key2, key_derivation &derivation) {
261  return crypto_ops::generate_key_derivation(key1, key2, derivation);
262  }
263  inline bool derive_public_key(const key_derivation &derivation, std::size_t output_index,
264  const public_key &base, public_key &derived_key) {
265  return crypto_ops::derive_public_key(derivation, output_index, base, derived_key);
266  }
267  inline void derivation_to_scalar(const key_derivation &derivation, size_t output_index, ec_scalar &res) {
268  return crypto_ops::derivation_to_scalar(derivation, output_index, res);
269  }
270  inline void derive_secret_key(const key_derivation &derivation, std::size_t output_index,
271  const secret_key &base, secret_key &derived_key) {
272  crypto_ops::derive_secret_key(derivation, output_index, base, derived_key);
273  }
274  inline bool derive_subaddress_public_key(const public_key &out_key, const key_derivation &derivation, std::size_t output_index, public_key &result) {
275  return crypto_ops::derive_subaddress_public_key(out_key, derivation, output_index, result);
276  }
277 
278  /* Generation and checking of a standard signature.
279  */
280  inline void generate_signature(const hash &prefix_hash, const public_key &pub, const secret_key &sec, signature &sig) {
281  crypto_ops::generate_signature(prefix_hash, pub, sec, sig);
282  }
283  inline bool check_signature(const hash &prefix_hash, const public_key &pub, const signature &sig) {
284  return crypto_ops::check_signature(prefix_hash, pub, sig);
285  }
286 
287  /* Generation and checking of a tx proof; given a tx pubkey R, the recipient's view pubkey A, and the key
288  * derivation D, the signature proves the knowledge of the tx secret key r such that R=r*G and D=r*A
289  * When the recipient's address is a subaddress, the tx pubkey R is defined as R=r*B where B is the recipient's spend pubkey
290  */
291  inline 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) {
292  crypto_ops::generate_tx_proof(prefix_hash, R, A, B, D, r, sig);
293  }
294  inline 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) {
295  return crypto_ops::check_tx_proof(prefix_hash, R, A, B, D, sig);
296  }
297 
298  /* To send money to a key:
299  * * The sender generates an ephemeral key and includes it in transaction output.
300  * * To spend the money, the receiver generates a key image from it.
301  * * Then he selects a bunch of outputs, including the one he spends, and uses them to generate a ring signature.
302  * To check the signature, it is necessary to collect all the keys that were used to generate it. To detect double spends, it is necessary to check that each key image is used at most once.
303  */
304  inline void generate_key_image(const public_key &pub, const secret_key &sec, key_image &image) {
305  crypto_ops::generate_key_image(pub, sec, image);
306  }
307  inline void generate_ring_signature(const hash &prefix_hash, const key_image &image,
308  const public_key *const *pubs, std::size_t pubs_count,
309  const secret_key &sec, std::size_t sec_index,
310  signature *sig) {
311  crypto_ops::generate_ring_signature(prefix_hash, image, pubs, pubs_count, sec, sec_index, sig);
312  }
313  inline bool check_ring_signature(const hash &prefix_hash, const key_image &image,
314  const public_key *const *pubs, std::size_t pubs_count,
315  const signature *sig) {
316  return crypto_ops::check_ring_signature(prefix_hash, image, pubs, pubs_count, sig);
317  }
318 
319  /* Variants with vector<const public_key *> parameters.
320  */
321  inline void generate_ring_signature(const hash &prefix_hash, const key_image &image,
322  const std::vector<const public_key *> &pubs,
323  const secret_key &sec, std::size_t sec_index,
324  signature *sig) {
325  generate_ring_signature(prefix_hash, image, pubs.data(), pubs.size(), sec, sec_index, sig);
326  }
327  inline bool check_ring_signature(const hash &prefix_hash, const key_image &image,
328  const std::vector<const public_key *> &pubs,
329  const signature *sig) {
330  return check_ring_signature(prefix_hash, image, pubs.data(), pubs.size(), sig);
331  }
332 
333  inline std::ostream &operator <<(std::ostream &o, const crypto::public_key &v) {
334  epee::to_hex::formatted(o, epee::as_byte_span(v)); return o;
335  }
336  inline std::ostream &operator <<(std::ostream &o, const crypto::secret_key &v) {
337  epee::to_hex::formatted(o, epee::as_byte_span(v)); return o;
338  }
339  inline std::ostream &operator <<(std::ostream &o, const crypto::key_derivation &v) {
340  epee::to_hex::formatted(o, epee::as_byte_span(v)); return o;
341  }
342  inline std::ostream &operator <<(std::ostream &o, const crypto::key_image &v) {
343  epee::to_hex::formatted(o, epee::as_byte_span(v)); return o;
344  }
345  inline std::ostream &operator <<(std::ostream &o, const crypto::signature &v) {
346  epee::to_hex::formatted(o, epee::as_byte_span(v)); return o;
347  }
348 
349  const extern crypto::public_key null_pkey;
350  const extern crypto::secret_key null_skey;
351 
352  inline std::string sign_message(const std::string &message, const std::string &privateKey) {
353  return crypto_ops::sign_message(message, privateKey);
354  }
355 
356  inline bool verify_signature(const std::string &message, const std::string &publicKey, const std::string &signature) {
357  return crypto_ops::verify_signature(message, publicKey, signature);
358  }
359 
360  inline bool verify_signature(const std::string &message, std::vector<std::string> publicKey, const std::string &signature) {
361  return crypto_ops::verify_signature(message, publicKey, signature);
362  }
363 
364  inline std::vector<std::string> create_ed25519_keypair() {
366  }
367 
368  inline std::string base64_decode(const std::string &val) {
369  using namespace boost::archive::iterators;
370  using It = transform_width<binary_from_base64<std::string::const_iterator>, 8, 6>;
371  return boost::algorithm::trim_right_copy_if(std::string(It(std::begin(val)), It(std::end(val))), [](char c) {
372  return c == '\0';
373  });
374  }
375 
376  inline std::string base64_encode(const std::string &val) {
377  using namespace boost::archive::iterators;
378  using It = base64_from_binary<transform_width<std::string::const_iterator, 6, 8>>;
379  auto tmp = std::string(It(std::begin(val)), It(std::end(val)));
380  return tmp.append((3 - val.size() % 3) % 3, '=');
381  }
382 }
383 
Definition: crypto.h:136
static bool check_key(const public_key &)
Definition: crypto.cpp:158
void operator=(const crypto_ops &)
static void derive_secret_key(const key_derivation &, std::size_t, const secret_key &, secret_key &)
static std::string sign_message(const std::string &message, const std::string &privateKey)
Definition: crypto.cpp:618
friend std::string base64_decode(std::string val)
static std::string base64_decode(std::string val)
static bool check_tx_proof(const hash &, const public_key &, const public_key &, const boost::optional< public_key > &, const public_key &, const signature &)
Definition: crypto.cpp:386
static void generate_signature(const hash &, const public_key &, const secret_key &, signature &)
Definition: crypto.cpp:260
static bool derive_subaddress_public_key(const public_key &, const key_derivation &, std::size_t, public_key &)
Definition: crypto.cpp:228
static bool derive_public_key(const key_derivation &, std::size_t, const public_key &, public_key &)
crypto_ops(const crypto_ops &)
static void derivation_to_scalar(const key_derivation &derivation, size_t output_index, ec_scalar &res)
Definition: crypto.cpp:188
static bool check_signature(const hash &, const public_key &, const signature &)
Definition: crypto.cpp:290
static bool verify_signature(const std::string &message, const std::string &publicKey, const std::string &signature)
Definition: crypto.cpp:633
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 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:314
static secret_key generate_keys(public_key &pub, secret_key &sec, const secret_key &recovery_key=secret_key(), bool recover=false)
Definition: crypto.cpp:136
static bool generate_key_derivation(const public_key &, const secret_key &, key_derivation &)
Definition: crypto.cpp:173
friend std::string base64_encode(std::string val)
static bool check_ring_signature(const hash &, const key_image &, const public_key *const *, std::size_t, const signature *)
static bool secret_key_to_public_key(const secret_key &, public_key &)
Definition: crypto.cpp:163
static std::string base64_encode(std::string val)
static std::vector< std::string > create_ed25519_keypair()
Definition: crypto.cpp:658
static void generate_key_image(const public_key &, const secret_key &, key_image &)
Definition: crypto.cpp:482
#define CRYPTO_MAKE_HASHABLE_CONSTANT_TIME(type)
Definition: generic-ops.h:80
#define CRYPTO_MAKE_COMPARABLE(type)
Definition: generic-ops.h:39
#define CRYPTO_MAKE_HASHABLE(type)
Definition: generic-ops.h:76
const uint32_t T[512]
Definition: groestl_tables.h:37
PUSH_WARNINGS
Definition: hash-ops.h:54
Definition: base.py:1
list B
Definition: base.py:26
int b
Definition: base.py:1
crypto namespace.
Definition: crypto.cpp:58
POD_CLASS secret_keyV
Definition: crypto.h:89
const crypto::public_key null_pkey
Definition: crypto.cpp:72
void generate_signature(const hash &prefix_hash, const public_key &pub, const secret_key &sec, signature &sig)
Definition: crypto.h:280
POD_CLASS public_keyM
Definition: crypto.h:94
bool verify_signature(const std::string &message, const std::string &publicKey, const std::string &signature)
Definition: crypto.h:356
bool check_key(const public_key &key)
Definition: crypto.h:244
void generate_random_bytes_thread_safe(size_t N, uint8_t *bytes)
Definition: crypto.cpp:91
std::vector< std::string > create_ed25519_keypair()
Definition: crypto.h:364
POD_CLASS ec_point
Definition: crypto.h:70
void hash_to_ec(const public_key &key, ge_p3 &res)
Definition: crypto.cpp:472
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:291
POD_CLASS signature
Definition: crypto.h:108
const crypto::secret_key null_skey
Definition: crypto.cpp:73
POD_CLASS public_keyV
Definition: crypto.h:84
std::enable_if< std::is_integral< T >::value, T >::type rand_range(T range_min, T range_max)
Definition: crypto.h:223
epee::mlocked< tools::scrubbed< ec_scalar > > secret_key
Definition: crypto.h:82
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:274
size_t rs_comm_size(size_t pubs_count)
Definition: crypto.cpp:491
POD_CLASS key_derivation
Definition: crypto.h:98
secret_key generate_keys(public_key &pub, secret_key &sec, const secret_key &recovery_key=secret_key(), bool recover=false)
Definition: crypto.h:238
void derive_secret_key(const key_derivation &derivation, std::size_t output_index, const secret_key &base, secret_key &derived_key)
Definition: crypto.h:270
std::vector< secret_keyV > column_vectors
Definition: crypto.h:97
bool generate_key_derivation(const public_key &key1, const secret_key &key2, key_derivation &derivation)
Definition: crypto.h:260
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:307
POD_CLASS public_key
Definition: crypto.h:76
void random32_unbiased(unsigned char *bytes)
Definition: crypto.cpp:110
bool derive_public_key(const key_derivation &derivation, std::size_t output_index, const public_key &base, public_key &derived_key)
Definition: crypto.h:263
void rand(size_t N, uint8_t *bytes)
Definition: crypto.h:197
std::string base64_encode(const std::string &val)
Definition: crypto.h:376
POD_CLASS key_image
Definition: crypto.h:102
bool check_signature(const hash &prefix_hash, const public_key &pub, const signature &sig)
Definition: crypto.h:283
POD_CLASS ec_scalar
Definition: crypto.h:74
std::string base64_decode(const std::string &val)
Definition: crypto.h:368
std::ostream & operator<<(std::ostream &o, const crypto::public_key &v)
Definition: crypto.h:333
bool secret_key_to_public_key(const secret_key &sec, public_key &pub)
Definition: crypto.h:250
std::enable_if< std::is_unsigned< T >::value, T >::type rand_idx(T sz)
Definition: crypto.h:232
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:294
void hash_to_scalar(const void *data, size_t length, ec_scalar &res)
Definition: crypto.cpp:126
int rows
Definition: crypto.h:86
POD_CLASS hash
Definition: hash.h:50
void random_scalar(ec_scalar &res)
Definition: crypto.cpp:122
void generate_key_image(const public_key &pub, const secret_key &sec, key_image &image)
Definition: crypto.h:304
std::string sign_message(const std::string &message, const std::string &privateKey)
Definition: crypto.h:352
void derivation_to_scalar(const key_derivation &derivation, size_t output_index, ec_scalar &res)
Definition: crypto.h:267
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:313
#define POD_CLASS
Definition: pod-class.h:44
Definition: crypto.h:120
ec_point a
Definition: crypto.h:121
Definition: crypto.h:213
static constexpr result_type min()
Definition: crypto.h:215
result_type operator()() const
Definition: crypto.h:217
uint64_t result_type
Definition: crypto.h:214
static constexpr result_type max()
Definition: crypto.h:216
Definition: crypto.h:123
hash h
Definition: crypto.h:124
struct ec_point_pair ab[]
Definition: crypto.h:125
Definition: crypto-ops.h:46
DISABLE_VS_WARNINGS(4244 4345 4503) using namespace crypto