Commit Graph

102 Commits

Author SHA1 Message Date
Ilya
6ff38d47db add frame size to poseidon hasher 2023-05-18 13:37:31 +03:00
Ilya
b015806983 support hash interface for poseidon; support golang crypto interfaces for bjj 2023-05-09 13:21:59 +03:00
Oleksandr Brezhniev
bd5255dea7 Switch to Apache 2.0 / MIT licenses (#54)
* Switch to Apache 2.0 / MIT licenses
2023-04-25 16:24:26 +03:00
Oleksandr Brezhniev
e5cf066b8b Poseidon Sponge Hash with different frame sizes (#52)
* Poseidon Sponge Hash with different frame sizes
* Update deps. Bump go version
* Update & fix linter.
* Refactor a bit.
* Reduce gc pressure
2023-03-08 20:18:55 +02:00
cool-developer
edc36bfa52 Merge pull request #49 from iden3/feature/neptune
Neptune Hash Implementation
2022-04-13 08:33:45 -04:00
Cool Developer
3c0a3adbbe remove the original hash function 2022-04-13 13:13:55 +01:00
Cool Developer
5ee5396d03 remove the bench 2022-04-11 15:35:18 +01:00
Cool Developer
49541f2ead fix the lint issues 2022-04-11 15:07:41 +01:00
Cool Developer
46665875c7 add the neptuen hash 2022-04-08 15:00:21 +01:00
cool-developer
d3e4218fe3 Merge pull request #46 from iden3/feature/golden
Golden poseidon hash implementation
2022-03-22 05:06:23 -04:00
cool-developer
5848bf2918 Update element.go 2022-03-18 14:06:18 -04:00
cool-developer
38240a6451 Remove unnecessary lines 2022-03-18 14:00:53 -04:00
cool-developer
0d6b33924a Update element_ops_amd64.s 2022-03-16 11:06:16 -04:00
cool-developer
52375f5e15 Update element_ops_amd64.s 2022-03-16 11:05:50 -04:00
Cool Developer
47b41d8ffc update the input params of hash 2022-03-15 07:33:14 -04:00
Cool Developer
1a046cf574 fix lint issues 2022-03-15 07:29:45 -04:00
Cool Developer
f0c462811a update the input params of hash 2022-03-15 07:27:18 -04:00
Cool Developer
26bfd1051a add the unit-test 2022-03-14 07:01:56 -04:00
Cool Developer
885e7c382e init commit for the golden poseidon 2022-03-11 07:26:42 -05:00
Oleksandr Brezhniev
f4972de131 Poseidon Sponge Hash implemented (#45)
* Poseidon Sponge Hash implemented
* Linter fixes and GHA go versions updated
2022-02-09 14:11:35 +02:00
Oleksandr Brezhniev
d53d6303be Added benchmark of Poseidon for 8 inputs 2022-02-01 19:17:04 +02:00
a_bennassar
b85be5b7f7 Add poseidon benchmark with 16 elements (#44)
Add poseidon benchmark with 16 elements
2022-02-01 17:22:47 +01:00
Oleksandr Brezhniev
69354ae29c Faster ff arithmetics (regenerated code with the newest goff) (#43) 2021-12-28 20:47:12 +02:00
Oleksandr Brezhniev
f597e20569 Fix Poseidon Hash check for inputs being in Finite Field (#42) 2021-11-21 02:58:03 +02:00
Oleksandr Brezhniev
64e757cc4a Better keccac256 (#41)
* Switch to keccac256 implementation from golang.org/x/crypto instead of go-ethereum
2021-11-19 17:00:10 +02:00
Mikhail Wall
9c2ca9ca7c made optimizaitions for consts init (#40) 2021-10-07 11:10:00 +03:00
Oleksandr Brezhniev
c544ba0f3c Extend Poseidon to 16 inputs (#39) 2021-10-06 16:09:20 +03:00
Oleksandr Brezhniev
ef9f86210a Extend Poseidon to 16 inputs (#37)
* Extend poseidon to 16 inputs. Better initialization of Poseidon constants
* Update deps
* Fix linter warnings
* Test vectors for poseidon with 14 inputs
2021-10-06 13:11:09 +03:00
Mikhail Wall
933c28a8d7 implemented optimized poseidon (#38)
* implemented optimized poseidon

* added comment to poseidon hash function

* deleted poseidonslow
2021-10-06 12:25:10 +03:00
Eduard S
8f85683b2c Merge pull request #36 from iden3/feature/poseidon-update-reference-impl
Update Poseidon last changes of the reference impl
2021-03-08 15:23:48 +01:00
arnaucube
590573a0af Update Poseidon last changes of the reference impl
Update Poseidon to last changes of the reference implementation from
26ddaa91db

Compatible with update at circomlib
(cf853c1cc9)
2021-03-08 14:59:42 +01:00
Eduard S
58e589b6eb Merge pull request #35 from iden3/feature/comp-point-test
Update and add test for PackSignY & UnpackSignY
2020-12-21 17:03:44 +01:00
arnaucube
2318fd7044 Update and add test for PackSignY & UnpackSignY
- Update PackSignY & UnpackSignY interface and description
- Add test for UnpackSignY & PackPoint
2020-12-21 16:58:13 +01:00
Eduard S
a0722b9e8f Merge pull request #34 from iden3/feature/exp-comppoint-signy
Abstract & expose CompressedPointToSignAndY
2020-12-21 16:21:27 +01:00
arnaucube
71dbddb5f1 Abstract & expose CompressedPointToSignAndY 2020-12-21 16:12:49 +01:00
Eduard S
0a5c6acba3 Merge pull request #33 from iden3/feature/pkcomp-scanvalue
Add scanner/valuer interface to babyjub.PublicKeyComp
2020-12-21 10:31:37 +01:00
arnaucube
a366175021 Add scanner/valuer interface to babyjub.PublicKeyComp 2020-12-18 20:44:29 +01:00
Eduard S
a2015adb2f Merge pull request #32 from iden3/feature/upgrade-linters
Upgrade linters
2020-12-18 12:11:45 +01:00
arnaucube
6d75396b4b Upgrade linters 2020-12-16 15:07:19 +01:00
Eduard S
821a601d20 Merge pull request #31 from iden3/feature/update-bbjjeddsa
Update BabyJubJub EdDSA to last circomlib version
2020-12-03 10:52:29 +01:00
arnaucube
5dd19b46dd Update BabyJubJub EdDSA to last circomlib version
- Update BabyJubJub EdDSA signature to last circomlib version (Poseidon
usage)
- Remove panic on hash error inside verification, to avoid panic due
field overflow of BabyJubJub signature verification
2020-12-02 19:57:27 +01:00
arnau
94e92e88fb Merge pull request #30 from iden3/feature/signaturecomp-scanner
Add scanner/valuer interface to babyjub.SignatureComp
2020-10-16 16:24:44 +02:00
Arnau B
5ef832f175 Add scanner/valuer interface to babyjub.SignatureComp 2020-10-16 16:22:18 +02:00
arnau
59d8c7a4ca Merge pull request #29 from iden3/feature/babyjubjub-optimization
- Add `add-2008-bbjlp` for point addition
- 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: aab1a681dd):
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
```
2020-09-13 20:05:04 +02:00
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: aab1a681dd):
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
```
2020-09-05 17:34:06 +02:00
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
2020-09-05 17:18:43 +02:00
arnaucube
e04ca5764a Update Poseidon to new circomlib version & https://extgit.iaik.tugraz.at/krypto/hadeshash 2020-08-23 19:40:58 +02:00
Eduard S
70841d78e7 Merge pull request #28 from iden3/feature/signature-sql-interface
Fix value sql interface
2020-08-14 13:03:25 +02:00
a_bennassar
674e8a6739 Fix value sql interface 2020-08-14 12:32:15 +02:00
arnau
66519124ca Merge pull request #27 from iden3/feature/signature-sql-interface
Add scanner/valuer interface to signature
2020-08-13 16:57:45 +02:00