Wire Sysio Wire Sysion 1.0.0
Loading...
Searching...
No Matches
test_point.hpp
Go to the documentation of this file.
1#pragma once
2#include "bn.h"
3
4#define PUT(x) std::cout << #x << "\t=" << (x) << std::endl;
5
6const struct Point {
7 struct G2 {
8 const char *aa;
9 const char *ab;
10 const char *ba;
11 const char *bb;
12 } g2;
13 struct G1 {
14 int a;
15 int b;
16 } g1;
17} g_pointTbl[] = {
18#ifdef BN_SUPPORT_SNARK
19 // SNARK1(b = 3)
20 {
21 {
22 "15267802884793550383558706039165621050290089775961208824303765753922461897946",
23 "9034493566019742339402378670461897774509967669562610788113215988055021632533",
24 "644888581738283025171396578091639672120333224302184904896215738366765861164",
25 "20532875081203448695448744255224543661959516361327385779878476709582931298750",
26 },
27 {
28 1, 2
29 },
30 },
31 // SNARK2(b = 82)
32 {
33 {
34 "7281644703356799059368313064438243279269372005747477888712173236228325795991",
35 "15160700668152503952980485502602536850541312794041965342451842375663084147486",
36 "13523979532236795535820810482891703536907572704519492618036353386190612673074",
37 "15929067770616689398844794432758732907995965312283969374632681891490787470887",
38 },
39 {
40 -1, 9
41 },
42 },
43#else
44 // Aranha
45 {
46 {
47 "12723517038133731887338407189719511622662176727675373276651903807414909099441",
48 "4168783608814932154536427934509895782246573715297911553964171371032945126671",
49 "13891744915211034074451795021214165905772212241412891944830863846330766296736",
50 "7937318970632701341203597196594272556916396164729705624521405069090520231616",
51 },
52 {
53 -1, 1
54 },
55 },
56#endif
57};
58
59inline const Point& selectPoint(const bn::CurveParam& cp)
60{
61#ifdef BN_SUPPORT_SNARK
62 if (cp.b != 3 && cp.b != 82) {
63 printf("not support point for b=%d\n", cp.b);
64 exit(1);
65 }
66 return g_pointTbl[cp.b == 3 ? 0 : 1];
67#else
68 if (cp != bn::CurveFp254BNb) {
69 printf("not support except for CurveFp254BNb");
70 exit(1);
71 }
72 return g_pointTbl[0];
73#endif
74}
BN parameter.
const CurveParam CurveFp254BNb
Definition bn.h:84
const char * ba
const char * ab
Definition test_point.hpp:9
const char * bb
const char * aa
Definition test_point.hpp:8
struct Point::G2 g2
struct Point::G1 g1
int b
Definition bn.h:67
const struct Point g_pointTbl[]
const Point & selectPoint(const bn::CurveParam &cp)