Electroneum
test_multiexp< algorithm, npoints, c > Class Template Reference

#include <multiexp.h>

Collaboration diagram for test_multiexp< algorithm, npoints, c >:

Public Member Functions

bool init ()
 
bool test ()
 

Static Public Attributes

static const size_t loop_count = npoints >= 1024 ? 10 : npoints < 256 ? 1000 : 100
 

Detailed Description

template<test_multiexp_algorithm algorithm, size_t npoints, size_t c = 0>
class test_multiexp< algorithm, npoints, c >

Definition at line 47 of file multiexp.h.

Member Function Documentation

◆ init()

template<test_multiexp_algorithm algorithm, size_t npoints, size_t c = 0>
bool test_multiexp< algorithm, npoints, c >::init ( )
inline

Definition at line 52 of file multiexp.h.

53  {
54  data.resize(npoints);
55  res = rct::identity();
56  for (size_t n = 0; n < npoints; ++n)
57  {
58  data[n].scalar = rct::skGen();
60  if (ge_frombytes_vartime(&data[n].point, point.bytes))
61  return false;
62  rct::key kn = rct::scalarmultKey(point, data[n].scalar);
63  res = rct::addKeys(res, kn);
64  }
65  straus_cache = rct::straus_init_cache(data);
66  pippenger_cache = rct::pippenger_init_cache(data);
67  return true;
68  }
std::shared_ptr< straus_cached_data > straus_init_cache(const std::vector< MultiexpData > &data, size_t N=0)
void scalarmultKey(key &aP, const key &P, const key &a)
Definition: rctOps.cpp:368
std::shared_ptr< pippenger_cached_data > pippenger_init_cache(const std::vector< MultiexpData > &data, size_t start_offset=0, size_t N=0)
void skGen(key &sk)
Definition: rctOps.cpp:253
void scalarmultBase(key &aG, const key &a)
Definition: rctOps.cpp:350
key identity()
Definition: rctOps.h:73
int ge_frombytes_vartime(ge_p3 *, const unsigned char *)
void addKeys(key &AB, const key &A, const key &B)
Definition: rctOps.cpp:420
Here is the call graph for this function:

◆ test()

template<test_multiexp_algorithm algorithm, size_t npoints, size_t c = 0>
bool test_multiexp< algorithm, npoints, c >::test ( )
inline

Definition at line 70 of file multiexp.h.

71  {
72  switch (algorithm)
73  {
75  return res == bos_coster_heap_conv_robust(data);
76  case multiexp_straus:
77  return res == straus(data);
79  return res == straus(data, straus_cache);
80  case multiexp_pippenger:
81  return res == pippenger(data, NULL, 0, c);
83  return res == pippenger(data, pippenger_cache, 0, c);
84  default:
85  return false;
86  }
87  }
rct::key straus(const std::vector< MultiexpData > &data, const std::shared_ptr< straus_cached_data > &cache=NULL, size_t STEP=0)
rct::key pippenger(const std::vector< MultiexpData > &data, const std::shared_ptr< pippenger_cached_data > &cache=NULL, size_t cache_size=0, size_t c=0)
rct::key bos_coster_heap_conv_robust(std::vector< MultiexpData > data)
Here is the call graph for this function:

Member Data Documentation

◆ loop_count

template<test_multiexp_algorithm algorithm, size_t npoints, size_t c = 0>
const size_t test_multiexp< algorithm, npoints, c >::loop_count = npoints >= 1024 ? 10 : npoints < 256 ? 1000 : 100
static

Definition at line 50 of file multiexp.h.


The documentation for this class was generated from the following file: