add test of N=2

dev
MITSUNARI Shigeo 9 years ago
parent dcc3c9edde
commit f843bc4636
  1. 19
      test/mont_fp_test.cpp

@ -321,9 +321,16 @@ struct Test {
void conv()
{
const char *bin = "0b100100011010001010110011110001001000000010010001101000101011001111000100100000001001000110100010101100111100010010000";
const char *hex = "0x123456789012345678901234567890";
const char *dec = "94522879687365475552814062743484560";
const char *bin, *hex, *dec;
if (Fp::getBitSize() <= 117) {
bin = "0b10000000000000000000000000000000000000000000000000000000000001110";
hex = "0x1000000000000000e";
dec = "18446744073709551630";
} else {
bin = "0b100100011010001010110011110001001000000010010001101000101011001111000100100000001001000110100010101100111100010010000";
hex = "0x123456789012345678901234567890";
dec = "94522879687365475552814062743484560";
}
Fp b(bin);
Fp h(hex);
Fp d(dec);
@ -623,6 +630,12 @@ CYBOZU_TEST_AUTO(test)
{
Test test;
const char *tbl[] = {
// N = 2
"0x0000000000000001000000000000000d",
"0x7fffffffffffffffffffffffffffffff",
"0x8000000000000000000000000000001d",
"0xffffffffffffffffffffffffffffff61",
// N = 3
"0x000000000000000100000000000000000000000000000033", // min prime
"0x00000000fffffffffffffffffffffffffffffffeffffac73",

Loading…
Cancel
Save