generated from napi-rs/package-template
-
Notifications
You must be signed in to change notification settings - Fork 0
/
simple-test-bls12-381.js
80 lines (73 loc) · 1.5 KB
/
simple-test-bls12-381.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
const fs = require('fs');
const {
setupFromCircomR1CsBls12381,
proveRangeBls12381,
verifyRangeBls12381,
} = require('./index.js');
const seed = Math.floor( Math.random() * 1000000 );
setupFromCircomR1CsBls12381(
"./circom/bls12-381/range_proof.r1cs",
1,
seed+1,
"./range_pk.bin",
"./range_vk.bin"
)
setupFromCircomR1CsBls12381(
"./circom/bls12-381/range_proof.r1cs",
1,
seed+2,
"./range_pk.bin",
"./range_vk.bin"
)
setupFromCircomR1CsBls12381(
"./circom/bls12-381/range_proof.r1cs",
1,
seed+2,
"./range_pk.bin",
"./range_vk.bin"
)
proveRangeBls12381(
"./circom/bls12-381/range_proof.r1cs",
"./circom/bls12-381/range_proof.wasm",
"./range_pk.bin",
"./test_proof1.bin",
"0xfffffffffffffff0",
seed+2
)
proveRangeBls12381(
"./circom/bls12-381/range_proof.r1cs",
"./circom/bls12-381/range_proof.wasm",
"./range_pk.bin",
"./test_proof2.bin",
"0xabc1234567ab",
seed+3
)
proveRangeBls12381(
"./circom/bls12-381/range_proof.r1cs",
"./circom/bls12-381/range_proof.wasm",
"./range_pk.bin",
"./test_proof3.bin",
"0xabc1234567ab",
seed+4
)
console.log(
"verify :\t",
verifyRangeBls12381(
"./range_vk.bin",
"./test_proof1.bin"
)
)
console.log(
"verify :\t",
verifyRangeBls12381(
"./range_vk.bin",
"./test_proof2.bin"
)
)
console.log(
"verify :\t",
verifyRangeBls12381(
"./range_vk.bin",
"./test_proof3.bin"
)
)