arnaucube
91767c7b61
Add goff to BabyJubJub point addition
```
Benchmarks (On a Intel(R) Core(TM) i7-8705G CPU @ 3.10GHz, with 32 GB of RAM):
- Old (commit: e04ca5764a
):
BenchmarkBabyjub/AddConst-8 1000000 1072 ns/op
BenchmarkBabyjub/AddRnd-8 93417 12943 ns/op
BenchmarkBabyjub/MulRnd-8 252 4797810 ns/op
BenchmarkBabyjub/Compress-8 7291580 166 ns/op
BenchmarkBabyjub/InCurve-8 611137 1999 ns/op
BenchmarkBabyjub/InSubGroup-8 615792 2021 ns/op
BenchmarkBabyjubEddsa/SignMimc7-8 126 9358542 ns/op
BenchmarkBabyjubEddsa/VerifyMimc7-8 124 9484005 ns/op
BenchmarkBabyjubEddsa/SignPoseidon-8 126 9486484 ns/op
BenchmarkBabyjubEddsa/VerifyPoseidon-8 126 9622807 ns/op
- With new point addition algorithm (commit: aab1a681dd4b00cab49f39f9e30d6f28034589c1):
BenchmarkBabyjub/AddConst-8 1356836 881 ns/op
BenchmarkBabyjub/AddRnd-8 274112 4220 ns/op
BenchmarkBabyjub/MulRnd-8 492 2474412 ns/op
BenchmarkBabyjub/Compress-8 6964855 197 ns/op
BenchmarkBabyjub/InCurve-8 608169 2008 ns/op
BenchmarkBabyjub/InSubGroup-8 618772 1954 ns/op
BenchmarkBabyjubEddsa/SignMimc7-8 238 4962397 ns/op
BenchmarkBabyjubEddsa/VerifyMimc7-8 235 5234883 ns/op
BenchmarkBabyjubEddsa/SignPoseidon-8 240 5028720 ns/op
BenchmarkBabyjubEddsa/VerifyPoseidon-8 243 5226654 ns/op
Point Addition: ~3x
Point scalar Mul: ~1.9x
Signature (poseidon): ~1.88x
Verification (poseidon): ~1.84x
- With new point addition algorithm & goff (current commit):
BenchmarkBabyjub/AddConst-8 3000531 400 ns/op
BenchmarkBabyjub/AddRnd-8 2770335 428 ns/op
BenchmarkBabyjub/MulRnd-8 6636 175522 ns/op
BenchmarkBabyjub/Compress-8 7358768 180 ns/op
BenchmarkBabyjub/InCurve-8 539193 1950 ns/op
BenchmarkBabyjub/InSubGroup-8 601402 1958 ns/op
BenchmarkBabyjubEddsa/SignMimc7-8 2940 409487 ns/op
BenchmarkBabyjubEddsa/VerifyMimc7-8 2908 414407 ns/op
BenchmarkBabyjubEddsa/SignPoseidon-8 2395 493165 ns/op
BenchmarkBabyjubEddsa/VerifyPoseidon-8 2491 494849 ns/op
Point Addition: ~9.86x
Point scalar Mul: ~14x
Signature (poseidon): ~10.2x
Verification (poseidon): ~10.56x
---
Total improvement (from old to current):
Point Addition: ~30.24x
Point scalar Mul: ~27.33x
Signature (poseidon): ~19.24x
Verification (poseidon): ~19.44x
```
4 years ago
arnaucube
aab1a681dd
Add add-2008-bbjlp for point addition
Add `add-2008-bbjlp` for point addition
Benchmarks (On a Intel(R) Core(TM) i7-8705G CPU @ 3.10GHz, with 32 GB of RAM):
```
- Old:
BenchmarkBabyjub/AddConst-8 1000000 1072 ns/op
BenchmarkBabyjub/AddRnd-8 93417 12943 ns/op
BenchmarkBabyjub/MulRnd-8 252 4797810 ns/op
BenchmarkBabyjub/Compress-8 7291580 166 ns/op
BenchmarkBabyjub/InCurve-8 611137 1999 ns/op
BenchmarkBabyjub/InSubGroup-8 615792 2021 ns/op
BenchmarkBabyjubEddsa/SignMimc7-8 126 9358542 ns/op
BenchmarkBabyjubEddsa/VerifyMimc7-8 124 9484005 ns/op
BenchmarkBabyjubEddsa/SignPoseidon-8 126 9486484 ns/op
BenchmarkBabyjubEddsa/VerifyPoseidon-8 126 9622807 ns/op
- With new point addition algorithm:
BenchmarkBabyjub/AddConst-8 1356836 881 ns/op
BenchmarkBabyjub/AddRnd-8 274112 4220 ns/op
BenchmarkBabyjub/MulRnd-8 492 2474412 ns/op
BenchmarkBabyjub/Compress-8 6964855 197 ns/op
BenchmarkBabyjub/InCurve-8 608169 2008 ns/op
BenchmarkBabyjub/InSubGroup-8 618772 1954 ns/op
BenchmarkBabyjubEddsa/SignMimc7-8 238 4962397 ns/op
BenchmarkBabyjubEddsa/VerifyMimc7-8 235 5234883 ns/op
BenchmarkBabyjubEddsa/SignPoseidon-8 240 5028720 ns/op
BenchmarkBabyjubEddsa/VerifyPoseidon-8 243 5226654 ns/op
```
Point Addition: ~3x
Point scalar Mul: ~1.9x
Signature (poseidon): ~1.88x
Verification (poseidon): ~1.84x
4 years ago
arnaucube
e04ca5764a
Update Poseidon to new circomlib version & https://extgit.iaik.tugraz.at/krypto/hadeshash
4 years ago
Eduard S
70841d78e7
Merge pull request #28 from iden3/feature/signature-sql-interface
Fix value sql interface
4 years ago
a_bennassar
674e8a6739
Fix value sql interface
4 years ago
arnau
66519124ca
Merge pull request #27 from iden3/feature/signature-sql-interface
Add scanner/valuer interface to signature
4 years ago
a_bennassar
a86308cb0b
Add scanner/valuer interface to PublicKey
4 years ago
a_bennassar
d91a4261f1
Add scanner/valuer interface to signature
4 years ago
Eduard S
327a8175d6
Merge pull request #26 from iden3/feature/pointfromsigny
Babyjubjub separate PointFromSignAndY from p.Decompress
4 years ago
arnaucube
833f68a614
Babyjubjub separate PointFromSignAndY from p.Decompress
4 years ago
Eduard S
29a66457f0
Merge pull request #25 from iden3/feature/poseidon-update
Update Poseidon Hash function names, rm HashBytes
4 years ago
arnaucube
f22be3cdee
Update Poseidon Hash function names, rm HashBytes
Since Poseidon Hash is used because of compatibility in zkSNARK circuits, due
circuit constraints number, the hash method of [T]*big.Int is the one directly
compatible with the circuits, is the method which have the `Hash` name on it.
The method that can take arbitrary length of []*big.Int putting them in chunks
of [T]*big.Int and iterating, is called `HashSlice`. The `HashBytes` has been
removed, as is a method that will not be used in zkSNARK circuits due high
constraints number.
For zkSNARK circuits, should be used `poseidon.Hash([poseidon.T]*big.Int)`.
4 years ago
Eduard S
2c471ab545
Merge pull request #24 from iden3/fix/hashbytes-err
Poseidon & MiMC7 HashBytes remove return of err
4 years ago
arnaucube
e134988b1b
Rm .travis.yml
4 years ago
arnaucube
3a9171000b
Poseidon & MiMC7 HashBytes remove return of err
4 years ago
Eduard S
b1468fc076
Merge pull request #23 from iden3/feature/expose-method
Expose SkToBigInt for usage from other packages & repos
4 years ago
arnaucube
d189a6bedc
Expose SkToBigInt for usage from other packages & repos
4 years ago
Eduard S
14c3144613
Merge pull request #22 from iden3/feature/utils-elembigintconv
Add utils.ElementArrayToBigIntArray
4 years ago
arnaucube
b98a9fe65a
Add utils.ElementArrayToBigIntArray
4 years ago
arnau
4d1bbacd6c
Merge pull request #21 from iden3/feature/githubactions
Add github actions and remove travis
4 years ago
Eduard S
0ac8b46493
Fix linters errors
4 years ago
Eduard S
14d09916cf
Add github actions and remove travis
4 years ago
arnau
eb41fe0757
Merge pull request #18 from iden3/feature/fix32bits
Fix compat with 32 bit arch
4 years ago
Eduard S
e10db811aa
Fix compat with 32 bit arch
4 years ago
Eduard S
ee467c6215
Merge pull request #16 from iden3/feature/mimc7-goff
Feature/mimc7 goff
4 years ago
arnaucube
4750e9c83c
Remove field package which is no longer used
4 years ago
arnaucube
16a8a18a6d
Optimize MiMC7 migrating from *big.Int to goff
Optimize MiMC7 migrating from *big.Int to goff generated finite field
operations.
There is still a lot of room for optimization for MiMC7 in the way that is done internally, but will be done in the future.
Benchmarks:
Tested on a Intel(R) Core(TM) i5-7200U CPU @ 2.50GHz, with 16GB of RAM.
- Before:
```
BenchmarkMIMC7-4 1026 1160298 ns/op
```
- After this commit:
```
BenchmarkMIMC7-4 19263 61651 ns/op
```
4 years ago
arnau
e8be761ec7
Merge pull request #15 from iden3/feature/poseidon-opt-goff
Feature/poseidon opt goff
4 years ago
arnaucube
2a3f0d9ed5
Adapt babyjub/eddsa to new Poseidon methods
4 years ago
Eduard S
5d88f7c4cd
Merge pull request #13 from iden3/feature/update-bbjj-sig
Update BabyJubJub signature with Poseidon
4 years ago
arnaucube
b45d8a582b
Optimize Poseidon migrating from *big.Int to goff
Optimize Poseidon migrating from *big.Int to goff generated finite field
operations.
Benchmarks:
Tested on a Intel(R) Core(TM) i5-7200U CPU @ 2.50GHz, with 16GB of RAM.
- Before the optimizations:
```
BenchmarkPoseidon-4 470 2489678 ns/op
BenchmarkPoseidonLarge-4 476 2530568 ns/op
```
- With the optimizations of #12 :
```
BenchmarkPoseidon-4 766 1550013 ns/op
BenchmarkPoseidonLarge-4 782 1547572 ns/op
```
- With the changes of this PR, where uses goff generated code instead of *big.Int:
```
BenchmarkPoseidon-4 9638 121651 ns/op
BenchmarkPoseidonLarge-4 9781 119921 ns/op
```
4 years ago
arnaucube
83f87bfa46
Resolve #4
4 years ago
arnaucube
17bad75853
Add goff generated finite field arithmetic code for used field
4 years ago
arnaucube
97c76ce614
Update BabyJubJub signature with Poseidon
4 years ago
arnau
937500b203
Merge pull request #12 from iden3/feature/optimizeposeidon
Optimize Poseidon
5 years ago
Eduard S
c0c4ff2dd7
Optimize Poseidon
5 years ago
Eduard S
8d5a7a7ccb
Merge pull request #11 from iden3/fix/issue-9
Fix/issue #9
5 years ago
arnaucube
c754d01ce0
poseidon consistent use of T
5 years ago
arnaucube
fcb586591a
fix #9
5 years ago
Eduard S
7c6170453e
Add test that breaks poseidion due to padding
5 years ago
Eduard S
27ec5b26df
Add test that breaks poseidon due to a security issue
5 years ago
Eduard S
53b9050d0a
Add babujub eddsa benchmarks
5 years ago
Eduard S
a5b6afcb16
Add poseidon and babyjub benchmarks
5 years ago
arnau
4356f44a3d
Merge pull request #6 from iden3/feature/testBJPKField
Test that babyjub pk is always < Q
5 years ago
Eduard S
5ade04e079
Test that babyjub pk is always < Q
5 years ago
Eduard S
eb7d86c5b3
Merge pull request #5 from iden3/decompress-modsqrt
return error if no ModSqrt(x, q) exist in babyjubjub decompress point
5 years ago
arnaucube
a60e154d86
return error if no ModSqrt(x, q) exist in babyjubjub decompress point
5 years ago
arnaucube
c95c95b7b1
add Poseidon multihash ([]*big.Int), add HashBytes for MiMC7 & Poseidon
5 years ago
arnaucube
2b1935299c
MiMC7 finite field over R comprovation moved inside hash, same approach as Poseidon impl
5 years ago
arnaucube
0bac1c84ba
add babyjub-eddsa Poseidon sign & verify
5 years ago