|
|
|
@ -1065,9 +1065,42 @@ void testEth2phase0() |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
template<class T> |
|
|
|
|
void testHashToG1(const T& mapto) |
|
|
|
|
void testSswuG1(const T& mapto) |
|
|
|
|
{ |
|
|
|
|
(void)mapto; |
|
|
|
|
const struct { |
|
|
|
|
const char *u; |
|
|
|
|
const char *xn; |
|
|
|
|
const char *xd; |
|
|
|
|
const char *y; |
|
|
|
|
} tbl[] = { |
|
|
|
|
{ |
|
|
|
|
"0", |
|
|
|
|
"2906670324641927570491258158026293881577086121416628140204402091718288198173574630967936031029026176254968826637280", |
|
|
|
|
"134093699507829814821517650980559345626771735832728306571853989028117161444712301203928819168120125800913069360447", |
|
|
|
|
"883926319761702754759909536142450234040420493353017578303105057331414514426056372828799438842649753623273850162620", |
|
|
|
|
}, |
|
|
|
|
{ |
|
|
|
|
"1", |
|
|
|
|
"1899737305729263819017890260937734483867440857300594896394519620134021106669873067956151260450660652775675911846846", |
|
|
|
|
"2393285161127709615559578013969192009035621989946268206469810267786625713154290249995541799111574154426937440234423", |
|
|
|
|
"930707443353688021592152842018127582116075842630002779852379799673382026358889394936840703051493045692645732041175", |
|
|
|
|
}, |
|
|
|
|
{ |
|
|
|
|
"2445954111132780748727614926881625117054159133000189976501123519233969822355358926084559381412726536178576396564099", |
|
|
|
|
"1380948948858039589493865757655255282539355225819860723137103295095584615993188368169864518071716731687572756871254", |
|
|
|
|
"3943815976847699234459109633672806041428347164453405394564656059649800794974863796342327007702642595444543195342842", |
|
|
|
|
"2822129059347872230939996033946474192520362213555773694753196763199812747558444338256205967106315253391997542043187", |
|
|
|
|
}, |
|
|
|
|
}; |
|
|
|
|
for (size_t i = 0; i < CYBOZU_NUM_OF_ARRAY(tbl); i++) { |
|
|
|
|
Fp u; |
|
|
|
|
u.setStr(tbl[i].u); |
|
|
|
|
Fp xn, xd, y; |
|
|
|
|
mapto.sswuG1(xn, xd, y, u); |
|
|
|
|
CYBOZU_TEST_EQUAL(xn.getStr(), tbl[i].xn); |
|
|
|
|
CYBOZU_TEST_EQUAL(xd.getStr(), tbl[i].xd); |
|
|
|
|
CYBOZU_TEST_EQUAL(y.getStr(), tbl[i].y); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
CYBOZU_TEST_AUTO(test) |
|
|
|
@ -1092,5 +1125,5 @@ CYBOZU_TEST_AUTO(test) |
|
|
|
|
testHashToFp2v6(mapto); |
|
|
|
|
testHashToFp2v7(mapto); |
|
|
|
|
testEth2phase0(); |
|
|
|
|
testHashToG1(mapto); |
|
|
|
|
testSswuG1(mapto); |
|
|
|
|
} |
|
|
|
|