Commit Graph

22 Commits

Author SHA1 Message Date
Luke Parker a46b5be95c
Add zeroize 2023-05-18 18:26:06 -04:00
Luke Parker f89331c06e
Optimize scalar multiplication with a 4-bit window
This moves from 255 doubles and 255 additions to 259 doubles and 71 additions.
If doubling is twice as fast, which is roughly the case as far as I can tell,
this shifts the function from executing in (255 + (255 * 2)) = 765 time to
(259 + (71 * 2)) = 401 time, a 48% speedup.
2023-05-18 18:21:34 -04:00
Jack Grigg 9862b247d2 Migrate remaining `FieldExt` constants and methods into `ff` 2022-11-25 05:05:54 +00:00
Jack Grigg fbce21598d Remove `crate::arithmetic::Group` trait
It was only present to enable an FFT implementation in `halo2_proofs`
that is generic over fields and groups, but we can replace it with an
equivalent trait in `halo2_proofs` that can have a blanket impl.
2022-11-24 20:48:23 +00:00
Jack Grigg 1c21a8944c Migrate to `ff` revision with trait constants 2022-11-19 12:16:10 +00:00
Volker Mische fb04f7ad99 Update to ec-gpu 0.2 release
The traits of ec-gpu changed a bit, there's now also a `GpuName`
trait that needs to be implemented.

BREAKING CHANGE: `ec-gpu` v0.2 traits are not compatible with v0.1

All dependencies that use `ec-gpu` need to be on v0.2.
2022-09-07 15:44:48 +02:00
Andy Polyakov ef39fba64c Simplify $name_affine.ct_eq().
By @ebfull's suggestion.
2022-04-18 19:04:03 +02:00
Andy Polyakov 3507ba6ffe Omit 'infinity' field from affine coordinates structure. 2022-04-13 22:23:23 +02:00
Andy Polyakov 872065c8a1 Add 'repr-c' feature to facilitate FFI. 2022-02-17 17:06:02 +01:00
Jack Grigg 53f65f7e6d Changelog and comment cleanups 2022-01-03 13:56:07 +00:00
Jack Grigg 21fd9e2c1b Remove `std` feature flag
Closes zcash/pasta_curves#27.
2021-12-22 05:41:04 +00:00
Jack Grigg 96116e20e5 Annotate docs with required feature flags 2021-12-07 14:31:27 +00: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
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 8fabb44ad4 fields: Use `ff::PrimeField` instead of `FieldExt` where possible 2021-09-20 17:41:46 +01:00
Jack Grigg fd7a6edbb1 ff 0.11, group 0.11 2021-09-02 18:10:05 +01:00
Jack Grigg 43251286c0 Enable Pasta curve elements to be used with `group::Wnaf` 2021-08-06 01:23:27 +01:00
Jack Grigg a6b018fb0e impl CofactorCurve for Pallas and Vesta
They already implement CofactorGroup (trivially, with the prime-order
subgroup being Self); this just enables Pallas and Vesta to be used in
cofactor-aware protocols that also want to leverage the affine point
representation.
2021-06-04 00:54:39 +01: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 901ef2381e clippy: Allow binary operators in Mul impls for curves
We use binary operators specifically to implement constant-time scalar
multiplication.
2021-03-03 22:00:22 +00:00
Jack Grigg b06937103d clippy: Use *Assign to implement arithmetic::Group trait 2021-03-03 22:00:22 +00:00
Jack Grigg d40ed36d50 Move Pasta implementations into root 2021-03-03 21:59:08 +00:00