forked from 0xPolygonZero/plonky2
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #11 from okx/dev-cliff-support-bn128
support bn128 and circom
- Loading branch information
Showing
49 changed files
with
11,465 additions
and
1,894 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,4 +14,5 @@ docs/**bench** | |
|
||
**/*/libposeidon-permute-c-mac.a | ||
**/*/go-iden3-crypto/ | ||
node_modules | ||
.vscode |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
pragma circom 2.0.9; | ||
|
||
template GlExp() { | ||
signal input x; | ||
signal input n; | ||
signal output out; | ||
|
||
signal e2[65]; | ||
signal temp1[64]; | ||
signal temp2[64]; | ||
signal mul[65]; | ||
mul[0] <== 1; | ||
e2[0] <== x; | ||
for (var i = 0; i < 64; i++) { | ||
temp1[i] <-- (n >> i) & 1; | ||
temp2[i] <== e2[i] * temp1[i] + 1 - temp1[i]; | ||
mul[i + 1] <== mul[i] * temp2[i]; | ||
e2[i + 1] <== e2[i] * e2[i]; | ||
} | ||
|
||
out <== mul[64]; | ||
} | ||
|
||
template GlExtMul() { | ||
signal input a[2]; | ||
signal input b[2]; | ||
signal output out[2]; | ||
|
||
var W = 7; | ||
signal tmp1 <== W * a[1] * b[1]; | ||
signal tmp2 <== a[1] * b[0]; | ||
|
||
out[0] <== a[0] * b[0] + tmp1; | ||
out[1] <== a[0] * b[1] + tmp2; | ||
} |
Oops, something went wrong.