Jack Grigg
e31787d462
Remove unnecessary bounds on CurveExt
...
They are already bounds on `group::Group`, which `CurveExt` inherits
via `group::prime::PrimeCurve`.
2021-09-23 14:45:02 +01:00
Jack Grigg
1b2f581ac1
Move square-root operations from FieldExt into a separate trait
2021-09-23 14:45:02 +01:00
Jack Grigg
aeda766c34
Remove FieldExt::ROOT_OF_UNITY
...
We can use the `ff::PrimeField::root_of_unity` method everywhere we
currently use this associated constant. If there is a more general
need for accessing this as an associated constant, we should consider
that for `ff::PrimeField`.
2021-09-23 14:44:10 +01:00
str4d
2b350118b0
Fix naming of Tonelli-Shanks
...
Co-authored-by: Daira Hopwood <daira@jacaranda.org>
2021-09-21 10:44:07 +12:00
Jack Grigg
9999964d17
Add no-std support
...
We re-introduce the Tonelli-Shank square root algoritm that was removed
in zcash/halo2#120 , to use in no-std mode (the table-based impl requires
allocations, and also uses 29kiB of memory which is a problem for
constrained environments that typically need no-std).
2021-09-20 18:56:23 +01:00
Jack Grigg
fd7a6edbb1
ff 0.11, group 0.11
2021-09-02 18:10:05 +01:00
Jack Grigg
38db112596
Fix clippy lints
2021-06-01 23:34:22 +01:00
Jack Grigg
ccbfaf6a20
Remove large temprary stack allocations from SqrtTables::new
2021-04-28 14:21:45 +12:00
Jack Grigg
b016b972f8
Replace (x, y) tuple with Coordinates struct
...
The previous `CurveAffine::get_xy` method returned the coordinates as
`CtOption<(C::Base, C::Base)>`. However, `ConditionallySelectable` is
not implemented for any tuple or array types, making it impossible to
use any of the useful `CtOption` methods like `and_then`. We replace it
with `CurveAffine::coordinates -> CtOption<Coordinates<Self>>` and
`impl ConditionallySelectable for Coordinates` to enable operating over
coordinates in constant time.
2021-04-18 09:21:18 +12:00
Jack Grigg
b36356667f
Rename crate to pasta_curves and remove halo2 code
2021-03-03 21:59:08 +00:00
Jack Grigg
62e50ae6bd
Fix Group::random implementation for Pallas and Vesta
...
Also removes the broken CurveAffine::from_bytes_wide and unused
CurveAffine::to_bytes_wide methods.
2021-03-02 21:29:59 +00:00
Sean Bowe
12230a49e0
Move CURVE_ID to CurveExt.
2021-02-22 16:30:05 -07:00
Sean Bowe
1078f854e3
Remove BLAKE2B_PERSONALIZATION constant.
2021-02-22 15:53:22 -07:00
Sean Bowe
df8dcce042
Add CurveExt and AffineExt associated types to project Group trait implementations.
...
Co-authored-by: Jack Grigg <jack@electriccoin.co>
2021-02-22 15:47:57 -07:00
Jack Grigg
b4ed5295fe
Migrate to group traits
...
The `Curve` trait is now `CurveExt: group::prime::PrimeCurve`, and
`CurveAffine` is now `CurveAffine: group::prime::PrimeCurveAffine`.
There is no `CurveAffine` trait in `group`, and it's a widely-used
trait in this crate, so we don't rename it to `CurveAffineExt`.
2021-02-22 20:20:23 +00:00
Jack Grigg
55fb581f17
Define hash-to-curve over Curve, not CurveAffine
...
This removes an unnecessary layer of indirection from the type system,
and ensures that these APIs depend on the halo2-specific trait with the
extensions we require.
2021-02-22 20:12:10 +00:00
Jack Grigg
7037d55320
Rename Curve and CurveAffine properties to match group traits
2021-02-22 20:05:08 +00:00
Sean Bowe
e93de2c285
Avoid heap allocations within hash_to_curve.
2021-02-22 10:15:30 -07:00
Daira Hopwood
642aad68a3
Revert comment changes that are no longer relevant, now that we don't expose the isogenous curves in the API
2021-02-20 21:54:50 +00:00
Daira Hopwood
25ea5d07f7
Fix error in doc comment.
...
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2021-02-19 15:52:11 +00:00
Sean Bowe
b488355e13
Add example to hash_to_curve doc comment.
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
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
db11c47045
Apply suggestions from code review
...
Co-authored-by: ying tong <yingtong@z.cash>
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
Sean Bowe
dfa7d96fa9
Refactor verification key hashing logic to use Display impls.
2021-02-17 15:19:34 -07:00
therealyingtong
e0f9fe1dcf
Clippy fixes + address review comments
...
Co-authored-by: Jack Grigg <jack@electriccoin.co>
2021-01-24 08:07:30 +08:00
Sean Bowe
a0d7998785
Add implementations of read/write to CurveAffine and FieldExt.
2021-01-24 08:05:58 +08:00
Daira Hopwood
c7a12ee178
Add documentation of perfect hash parameters.
2021-01-17 02:24:09 +00:00
Daira Hopwood
adc3c9c2ea
Fix incorrect variable name in a comment.
...
Co-authored-by: str4d <thestr4d@gmail.com>
2021-01-17 01:52:49 +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
Jack Grigg
cdbc41148a
Migrate to ff traits
...
The `Field` trait in this crate is now `FieldExt: ff::PrimeField`.
2020-12-01 20:55:03 +00:00
Jack Grigg
3407d13e4b
Move curves and fields into tweedle module
2020-11-12 21:36:59 +00:00
Jack Grigg
f4c15760f2
Use explicit trait paths in arithmetic macros
2020-11-12 19:38:27 +00:00
ying tong
6f6378b2ea
More idiomatic implementation of Ord for Field
...
Co-authored-by: str4d <jack@z.cash>
2020-10-14 00:35:36 +08:00
therealyingtong
1e21c08acd
Implement Ord and PartialOrd for Field
2020-10-14 00:35:25 +08:00
ebfull
7250ac8252
Merge pull request #4 from zcash/permutation
...
Permutation
2020-09-07 12:24:31 -06:00
Dimitris Apostolou
c0444f8c31
Fix typos
2020-09-01 20:45:20 +03:00
Sean Bowe
c427795bf5
Reverse endianness of delta constants
2020-08-31 10:10:05 -06:00
therealyingtong
4f8570db95
Add DELTA generator of t-order multiplicative subgroup to Fp, Fq
2020-08-29 13:51:42 +08:00