mirror of
https://git.wownero.com/wownero/wownero.git
synced 2024-08-15 01:03:23 +00:00
CLSAG verification performance test
This commit is contained in:
parent
641b08c920
commit
5aa1575e91
2 changed files with 40 additions and 22 deletions
|
@ -61,6 +61,7 @@
|
||||||
#include "crypto_ops.h"
|
#include "crypto_ops.h"
|
||||||
#include "multiexp.h"
|
#include "multiexp.h"
|
||||||
#include "sig_mlsag.h"
|
#include "sig_mlsag.h"
|
||||||
|
#include "sig_clsag.h"
|
||||||
|
|
||||||
namespace po = boost::program_options;
|
namespace po = boost::program_options;
|
||||||
|
|
||||||
|
@ -215,6 +216,7 @@ int main(int argc, char** argv)
|
||||||
TEST_PERFORMANCE1(filter, p, test_cn_fast_hash, 16384);
|
TEST_PERFORMANCE1(filter, p, test_cn_fast_hash, 16384);
|
||||||
|
|
||||||
TEST_PERFORMANCE2(filter, p, test_sig_mlsag, 11, true); // MLSAG verification
|
TEST_PERFORMANCE2(filter, p, test_sig_mlsag, 11, true); // MLSAG verification
|
||||||
|
TEST_PERFORMANCE2(filter, p, test_sig_clsag, 11, 1); // CLSAG verification (with commitment offset)
|
||||||
|
|
||||||
TEST_PERFORMANCE2(filter, p, test_ringct_mlsag, 11, false);
|
TEST_PERFORMANCE2(filter, p, test_ringct_mlsag, 11, false);
|
||||||
TEST_PERFORMANCE2(filter, p, test_ringct_mlsag, 11, true);
|
TEST_PERFORMANCE2(filter, p, test_ringct_mlsag, 11, true);
|
||||||
|
|
|
@ -32,14 +32,17 @@
|
||||||
|
|
||||||
#include "ringct/rctSigs.h"
|
#include "ringct/rctSigs.h"
|
||||||
#include "cryptonote_basic/cryptonote_basic.h"
|
#include "cryptonote_basic/cryptonote_basic.h"
|
||||||
|
#include "device/device.hpp"
|
||||||
|
|
||||||
#include "single_tx_test_base.h"
|
#include "single_tx_test_base.h"
|
||||||
|
|
||||||
template<size_t ring_size, bool ver, size_t index>
|
using namespace rct;
|
||||||
|
|
||||||
|
template<size_t ring_size, size_t index>
|
||||||
class test_sig_clsag : public single_tx_test_base
|
class test_sig_clsag : public single_tx_test_base
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static const size_t n = ring_size;
|
static const size_t N = ring_size;
|
||||||
static const size_t loop_count = 1000;
|
static const size_t loop_count = 1000;
|
||||||
static const size_t l = index;
|
static const size_t l = index;
|
||||||
|
|
||||||
|
@ -48,36 +51,49 @@ public:
|
||||||
if (!single_tx_test_base::init())
|
if (!single_tx_test_base::init())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
p = rct::skGen();
|
message = identity();
|
||||||
z = rct::skGen();
|
|
||||||
P = rct::skvGen(n);
|
pubs.reserve(N);
|
||||||
C = rct::skvGen(n);
|
for (size_t i = 0; i < N; i++)
|
||||||
for (size_t i = 0 ; i < n; i++)
|
|
||||||
{
|
{
|
||||||
P[i] = rct::scalarmultBase(P[i]);
|
key sk;
|
||||||
C[i] = rct::scalarmultBase(C[i]);
|
ctkey tmp;
|
||||||
|
|
||||||
|
skpkGen(sk, tmp.dest);
|
||||||
|
skpkGen(sk, tmp.mask);
|
||||||
|
|
||||||
|
pubs.push_back(tmp);
|
||||||
}
|
}
|
||||||
P[l] = rct::scalarmultBase(p);
|
|
||||||
C[l] = rct::scalarmultBase(z);
|
key p;
|
||||||
|
skpkGen(p,pubs[l].dest);
|
||||||
|
|
||||||
sig = CLSAG_Gen(rct::identity(),P,p,C,z,l);
|
key t,u;
|
||||||
|
t = skGen();
|
||||||
|
u = skGen();
|
||||||
|
addKeys2(pubs[l].mask,t,u,H);
|
||||||
|
|
||||||
|
key t2;
|
||||||
|
t2 = skGen();
|
||||||
|
addKeys2(C_offset,t2,u,H);
|
||||||
|
|
||||||
|
ctkey insk;
|
||||||
|
insk.dest = p;
|
||||||
|
insk.mask = t;
|
||||||
|
|
||||||
|
sig = proveRctCLSAGSimple(message,pubs,insk,t2,C_offset,NULL,NULL,NULL,l,hw::get_device("default"));
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool test()
|
bool test()
|
||||||
{
|
{
|
||||||
if (ver)
|
return verRctCLSAGSimple(message,sig,pubs,C_offset);
|
||||||
return CLSAG_Ver(rct::identity(),P,C,sig);
|
|
||||||
else
|
|
||||||
CLSAG_Gen(rct::identity(),P,p,C,z,l);
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
rct::key p;
|
ctkeyV pubs;
|
||||||
rct::key z;
|
key C_offset;
|
||||||
rct::keyV P;
|
clsag sig;
|
||||||
rct::keyV C;
|
key message;
|
||||||
rct::clsag sig;
|
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue