9 Commits

Author SHA1 Message Date
Jakub Nabaglo
bc57a561e6 Delete CrandallField 2021-11-02 12:29:26 -07:00
Jakub Nabaglo
06e48d0b61
ARM-optimized Goldilocks Poseidon (#294)
* Optimized Poseidon for ARM

* Hamish comments

* Unused things
2021-10-30 14:32:39 -07:00
Jakub Nabaglo
609028c899
Poseidon-12 in hand-rolled ASM (#276)
* Goldilocks Poseidon-12 in asm

* Lints

* Hamish comments

* Reorganize arch-specific files
2021-10-13 09:47:50 -07:00
Hamish Ivey-Law
a0de564806
Implement Poseidon width 8 and 12 for Goldilocks field. (#268)
* Implement Poseidon width 8 and 12 for Goldilocks field.

* Comment on generating Poseidon implementations.

* Update Goldilocks 8 constants with corrected MDS matrix.

* Add Goldilocks test vectors and refactor tests.

* Add test vectors of all -1's.

* cargo fmt pedantry.
2021-09-28 10:51:03 +10:00
wborgeaud
422e72954c Working path (de)compression 2021-09-20 14:37:28 +02:00
Jakub Nabaglo
9ef784a99d
Poseidon: vectorized MDS matrix multiplication (NEON) (#231)
* Port of AVX2 MDS impl

* Bugfixes

* Inline ASM to the rescue

* remove debug printsln + minor formatting

* Work around NEON intrinsic bug without inline ASM

* Minor error in doc

* Daniel comments

* More Daniel comments

Co-authored-by: Jakub Nabaglo <jakub@mirprotocol.org>
2021-09-13 12:36:06 -07:00
Jakub Nabaglo
6465e35e1f
Poseidon: vectorized MDS matrix multiplication (AVX2) (#229)
* Poseidon: vectorized MDS matrix multiplication

* Lints

* This is a bit cleaner

* More cleanup

* Width 12

* Replace the unaligned load trick with something nicer

* Simplify conversion between CrandallField and u64

* Make things more concise with const generics

* Minor documentation

* Minor: unused import

* Daniel comments + consistency with #230 + errors in docs

* Remove dependence on feature(stdsimd)

* Daniel comments
2021-09-13 11:46:36 -07:00
Hamish Ivey-Law
92bc65a6b5
Native Poseidon implementation(s) (#207)
* Simplify and refactor GMiMC benchmark.

* Refactor/combine GMiMC and Rescue hash benchmarks.

* Remove old Rescue bench; rename GMiMC bench.

* Add from_canonical_u128 for fields.

* Initial version of Poseidon.

* Partial implementation of fast Poseidon.

* Complete (but broken) implementation of fast partial rounds.

* Fix index calculation.

* Add basic tests.

* Fix constants; fix bugs in fast partial round calculation.

* Rename main functions.

* Add test vectors.

* Use x^7 for s-box monomial.

* Fix s-box application in fast version.

* Make WIDTH a parameter.

* Working version with both widths.

* Updated the constants so they use x^3; added test vectors.

* Expand bench_hash to cover both widths and report relative slowdown.

* Remove references to MaybeUninit.

* First draft of refactoring the two Poseidon widths.

* Tidy up use of conversion to/from raw data.

* Add some comments.

* Refactor tests.

* Apply cargo fmt changes.

* Have `Field`s implement `PoseidonInterface` (#209)

* Have `Field`s implement `PoseidonInterface`

Rather than having a sort of "dummy struct" implement `PoseidonInterface` with the field as a generic param. I think this seems more natural and type-safe.

The type safety does come at a price -- it would be harder to do dynamic things such as taking `WIDTH` as a command line option -- but I think that's alright.

* Fix missed conflicts.

* cargo fmt fixes.

* Fix to accommodate changes in latest nightly.

Co-authored-by: Hamish Ivey-Law <426294+unzvfu@users.noreply.github.com>
Co-authored-by: Hamish Ivey-Law <hamish@ivey-law.name>

* Sanity check number of rounds.

Co-authored-by: Daniel Lubarov <daniel@lubarov.com>
2021-09-01 21:45:52 +10:00
Daniel Lubarov
018fb005f8
Move stuff around (#135)
No functional changes here. The biggest change was moving certain files into new directories like `plonk` and `iop` (for things like `Challenger` that could be used in STARKs or other IOPs). I also split a few files, renames, etc, but again nothing functional, so I don't think a careful review is necessary (just a sanity check).
2021-07-29 22:00:29 -07:00