Commit graph

43 commits

Author SHA1 Message Date
Jack Grigg
81a7936d99 pasta: Split halo2-specific curve-specific logic into a separate macro 2021-02-22 18:53:27 +00:00
Sean Bowe
e93de2c285
Avoid heap allocations within hash_to_curve. 2021-02-22 10:15:30 -07:00
Daira Hopwood
16e5f96f3f Fix a clippy lint.
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2021-02-22 16:02:38 +00:00
Daira Hopwood
e408a351d5 Remove a redundant bool::from.
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2021-02-21 21:43:11 +00:00
Daira Hopwood
7dc21f4727 Repair test vectors and add tests for map_to_curve_simple_swu.
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2021-02-21 21:01:19 +00:00
Daira Hopwood
24def7ce02 Fix case where the input to map_to_curve_simple_swu is 0, and remove unneeded B_OVER_ZA constants.
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2021-02-21 21:00:50 +00:00
Daira Hopwood
a14eccc13d Remove unused hash support for Pasta Fp and Fq.
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2021-02-20 21:51:32 +00:00
Daira Hopwood
8b8dbbe2bb Refine type of buf in hash_to_field as suggested by @ebfull.
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2021-02-19 15:52:11 +00:00
Daira Hopwood
6d8c899e16 Rename map_to_curve to map_to_curve_simple_swu.
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2021-02-19 15:52:11 +00:00
Daira Hopwood
785ad5375c Switch from XOF:SHAKE128 to XMD:BLAKE2b.
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2021-02-19 15:52:11 +00:00
Daira Hopwood
9aa3327a0a Fix clippy lints.
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2021-02-19 15:52:11 +00:00
Sean Bowe
c17cd408f1 Fix point doubling on isogenous curve and add test for isogeny of identity. 2021-02-19 15:52:11 +00:00
Sean Bowe
d14d2314a1 Remove isogenous curve from public API. 2021-02-19 15:52:11 +00:00
Sean Bowe
dc069dff31 Rename hasher to hash_to_curve. 2021-02-19 15:52:11 +00:00
Sean Bowe
f6f008f905 Remove MINUS_B_OVER_A constant. 2021-02-19 15:52:11 +00:00
Sean Bowe
c48229ce0f Remove dependency on byteorder crate 2021-02-19 15:52:11 +00:00
Sean Bowe
783e602e85 Remove SimplifiedSWUWithDegree3Isogeny structure because state is no longer necessary. 2021-02-19 15:52:11 +00:00
Sean Bowe
83e2656c3e Introduce Curve::hasher abstraction. 2021-02-19 15:52:11 +00:00
Sean Bowe
68a7a19d3b Move hashtocurve module into pasta module. 2021-02-19 15:52:11 +00:00
Sean Bowe
b134a73ef5 Hardcode isogeny constants and constants for hash to curve. 2021-02-19 15:52:11 +00:00
Sean Bowe
5b33ff9cab Consolidate the hashtocurve module traits into a single structure. 2021-02-19 15:52:11 +00:00
Sean Bowe
e4e8aef5b6 Simplify HashToCurve trait. 2021-02-19 15:52:11 +00:00
Daira Hopwood
fa3afc29bb Add an implementation of simplified SWU hash-to-curve.
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2021-02-19 15:52:11 +00:00
ebfull
9401ceb68d
Merge pull request #173 from zcash/vk-transcript
Hash verification key into transcript
2021-02-18 13:28:57 -07:00
Sean Bowe
dfa7d96fa9
Refactor verification key hashing logic to use Display impls. 2021-02-17 15:19:34 -07:00
Jack Grigg
0c4f779993 ff 0.9 2021-02-17 20:42:27 +00:00
Jack Grigg
8b2082877e Remove unnecessary let bindings 2021-01-29 23:43:13 +00:00
Daira Hopwood
c7a12ee178
Add documentation of perfect hash parameters. 2021-01-17 02:24:09 +00:00
Daira Hopwood
288a21ef1e Replace the Tonelli-Shanks sqrt algorithm with the table-based one.
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2021-01-14 02:34:43 +00:00
Daira Hopwood
c5e48fdd06 Address @ebfull's review comments.
Co-authored-by: Sean Bowe <sean@electriccoin.co>
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2021-01-14 02:34:43 +00:00
Daira Hopwood
af9834d68c Implement sqrt_alt, a more efficient way of doing sqrt_ratio(num, one()).
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2021-01-14 02:34:43 +00:00
Daira Hopwood
806748fbc4 Use addition chains for powering by (T-1)/2.
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2021-01-14 02:34:43 +00:00
Daira Hopwood
227025b7b3 Avoid exposing implementation details of the square root implementation.
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2021-01-14 02:34:43 +00:00
Daira Hopwood
e13ee2c8ff Add sqrt_ratio implementation.
Co-authored-by: Jack Grigg <jack@electriccoin.co>
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2021-01-14 02:34:43 +00:00
Sean Bowe
f308eb969c
Remove deterministic square root calculation as it's no longer needed. 2021-01-12 07:40:26 -07:00
Sean Bowe
dff5a3a692
Generate the URS using a homebrew mixture of blake2b and try-and-increment. 2021-01-06 10:45:11 -07:00
Sean Bowe
c25b7e7d09
cargo fmt 2020-12-13 10:37:32 -07:00
Sean Bowe
1c0daa5478
Add leading zeroes to hex in some constants. 2020-12-11 13:25:18 -07:00
ebfull
0101014268
Use constants where applicable in field implementations
Co-authored-by: str4d <jack@electriccoin.co>
2020-12-11 11:54:32 -07:00
Sean Bowe
81345e0cf1
Change ZETA constant of Fp to make it consistent with the endomorphism over Fq. 2020-12-07 09:42:33 -07:00
Sean Bowe
e7c4213537
Remove duplicative from_bytes_wide method in fq.rs; it already exists in the trait impl for FieldExt. 2020-12-04 17:22:02 -07:00
Sean Bowe
3b91899a19
Make comment consistent between fq.rs / fp.rs 2020-12-04 15:01:44 -07:00
Sean Bowe
95e41fcfcf
Rename curves to Pallas/Vesta (Pasta). 2020-12-03 13:47:47 -07:00