Commit Graph

54 Commits

Author SHA1 Message Date
Jack Grigg
c597db59a6 ff: Rename PrimeField::into_repr -> PrimeField::to_repr 2020-05-02 18:55:13 +12:00
Jack Grigg
9114c367f4 ff_derive: Generate modulus representation with correct endianness
Now that PrimeField::ReprEndianness exists, users can obtain a
known-endianness representation from the output of PrimeField::char
(which is a PrimeField::Repr, and should return a representation with
the same endianness as PrimeField::into_repr).
2020-05-02 18:54:02 +12:00
Jack Grigg
15e229509a ff: Move pow_vartime back into Field trait
The only places we don't use constant u64 limbs, we use PrimeField::char
instead (except in a single test where we use a field element).
2020-05-02 18:54:02 +12:00
Jack Grigg
38f87c2e73 ff: Add PrimeField::ReprEndianness associated type
This enables generic code to reliably operate on the bits of an encoded
field element, by converting them to and from a known (little)
endianness.

The BitAnd and Shr bounds on PrimeField are now removed, as users can
perform these operations themselves as needed.
2020-05-02 18:54:02 +12:00
Jack Grigg
55568b4d6e ff: Remove frobenius_map from Field trait
It is only used internally in the bls12_381 crate, and field extensions
aren't exposed anywhere in the Zcash stack.
2020-05-02 16:07:48 +12:00
Jack Grigg
1761ebfb35 ff: Remove SqrtField trait
The sqrt() function is now part of the Field trait. ff_derive returns an
error on fields for which it does not support generating a square root
function.

Note that Fq6 and Fq12 in pairing::bls12_381 leave the function
unimplemented. They will be dropped once the migration to the bls12_381
crate is complete. The equivalent structs in that crate are not exposed.
2020-05-02 16:07:48 +12:00
Jack Grigg
49f119fb03 ff: Remove PrimeFieldRepr trait
The ff::PrimeField::Repr associated type now has the minimal necessary
bounds, which can be satisfied by a newtype around a byte array.
2020-04-23 18:15:14 +12:00
Jack Grigg
08500ee712 ff: PrimeField: BitAnd<u64, Output = u64> + Shr<u32, Output = Self> 2020-04-23 16:23:24 +12:00
Jack Grigg
1fdca393bb ff: PrimeField::{is_even, is_odd} 2020-04-23 16:23:24 +12:00
Jack Grigg
232f0a50b8 ff: Rework BitIterator to work with both u8 and u64 limb sizes
This enables BitIterator to be used with both the byte encoding and limb
representation of scalars.
2020-04-23 16:23:24 +12:00
Jack Grigg
fd79de5408 ff: Add PrimeField: From<u64> constraint 2020-04-23 16:23:24 +12:00
Jack Grigg
b6457a905b ff: Move pow_vartime into a trait that is generic over the limb size
The trait is implemented by default for u8 and u64, allowing pow_vartime
to be used with both the byte encoding and limb representation of field
elements.
2020-03-28 00:27:59 +13:00
Jack Grigg
6e53cf3c4c group: Take scalar by reference in CurveProjective::recommended_wnaf_for_scalar 2020-03-26 19:00:46 +13:00
Jack Grigg
2df2a2b2f2 Merge branch 'develop' 2020-03-14 10:36:58 +13:00
Sean Bowe
100878cd14
Version bump of all crates (except librustzcash) 2020-03-12 15:59:19 -06:00
Sean Bowe
805aa45f9e
Merge commit '05a9f3360f7fbd298f3e6f8f7e55e9426d04f2f0' into depends-updates-2 2020-03-03 17:45:49 -07:00
Sean Bowe
05a9f3360f Squashed 'pairing/' changes from 3d41ee5..3870f11
3870f11 Bump version and ff dependency
e8657fa Merge pull request #108 from kigawas/fix-rngcore-sized
7fddfc7 Update Cargo.toml
df0217c bump group version
cbc1917 bump version
98133d9 fix RngCore Sized
583c744 pairing 0.15.0
0de7279 Fix pairing benchmarks
dd2fbb3 Crate docs
97c45f2 Update READMEs
9aef129 CI: Check intra-doc links
f552b49 Add READMEs to Cargo.toml files
8c59b4a cargo fmt
33993f4 cargo fix --edition-idioms for pairing
36788f3 Add edition = 2018
df88a3f cargo fmt
d9a1288 cargo fix --edition for pairing
013fd03 cargo fmt pairing
5635612 Fix clippy linter errors in pairing crate
ba40e2f Use modern clippy linter syntax
fa4eaeb Migrate to rand 0.7
1d00588 Migrate ff, group, pairing, and bellman to rand 0.6
95a749b Migrate pairing to rand 0.5
01e7212 Add ff and group crates to Cargo workspace

git-subtree-dir: pairing
git-subtree-split: 3870f1172f33aa85c49426fec6c6e7040b4889f9
2020-03-03 17:44:53 -07:00
str4d
702b5e5d8c
Merge pull request #193 from str4d/group-std-ops
Move Group operations to operator-backed traits
2020-01-28 17:41:50 +00:00
Jack Grigg
3c84625438 pairing: Allow clippy::cognitive_complexity in test_frob_coeffs 2020-01-14 22:00:17 -05:00
Jack Grigg
2f38316359 pairing: Fix various clippy issues 2020-01-14 22:00:17 -05:00
Jack Grigg
9c485cc97e Move from CurveProjective::add_assign_mixed to traits 2020-01-13 21:20:46 -05:00
Jack Grigg
1a8ec21c03 Move from Curve*::negate to Neg operator 2020-01-13 21:19:33 -05:00
Jack Grigg
8193324986 Move additive CurveProjective operators to traits 2020-01-13 21:19:33 -05:00
Jack Grigg
6c2c2b58de
Migrate pairing benchmarks to criterion 2019-12-19 16:46:16 -06:00
Jack Grigg
1c9f5742fa
Improve Field::pow API and impl
Renamed to Field::pow_vartime to indicate it is still variable time with
respect to the exponent.
2019-12-14 12:27:48 +00:00
Jack Grigg
3d2acf48ce
Constant-time field square root
WARNING: THIS IS NOT FULLY CONSTANT TIME YET!

This will be fixed once we migrate to the jubjub and bls12_381 crates.
2019-12-13 20:13:30 +00:00
Jack Grigg
40749da9a7
Constant-time field inversion
WARNING: THIS IS NOT ACTUALLY CONSTANT TIME YET!

The jubjub and bls12_381 crates will replace our constant-time usages,
but we NEED to fix ff_derive because other users will expect it to
implement the Field trait correctly.
2019-12-13 19:46:04 +00:00
Jack Grigg
662be3551f
impl ConditionallySelectable for Field 2019-12-12 23:15:48 +00:00
Jack Grigg
cded08b0c5
Make Field::square take &self and return Self 2019-12-12 23:09:28 +00:00
Jack Grigg
9dac748224
Make Field::double take &self and return Self 2019-12-12 22:59:18 +00:00
Jack Grigg
91c32f1c7c
Move from Field::negate to Neg operator 2019-12-12 22:52:17 +00:00
Jack Grigg
27c8f34601
Move Field operations to operator-backed traits
The ff_derive, pairing, zcash_primitives::jubjub, and bellman dummy_engine
changes are minimally implemented on top of the existing *_assign()
functions.
2019-12-12 21:19:46 +00:00
Sean Bowe
96f602e452
cargo fmt 2019-12-12 11:46:05 -07:00
Jack Grigg
68cada53cf
pairing 0.15.0 2019-10-08 17:43:33 +13:00
Jack Grigg
b872e9fc49
Fix pairing benchmarks
They were broken by #91 but went unnoticed because CI does not compile
the benchmarks, which requires the nightly toolchain.
2019-10-08 15:25:41 +13:00
Jack Grigg
4ad3988e43
Crate docs 2019-09-24 14:23:59 +01:00
Jack Grigg
7f3036d2c8
Update READMEs 2019-09-24 14:23:55 +01:00
Jack Grigg
d9a0b9c83f
CI: Check intra-doc links
Credit: https://twitter.com/tomaka17/status/1176017851410526208
2019-09-24 10:35:12 +01:00
Jack Grigg
1d02363752
Add READMEs to Cargo.toml files
This will cause crates.io to render each crate's README as its
information page.
2019-09-23 14:42:38 +01:00
Eirik Ogilvie-Wigley
76795a9014 cargo fmt 2019-08-20 22:22:03 -06:00
Eirik Ogilvie-Wigley
9807a5c1cc cargo fix --edition-idioms for pairing 2019-08-20 22:16:40 -06:00
Eirik Ogilvie-Wigley
09882c6d08 Add edition = 2018 2019-08-20 18:31:20 -06:00
Eirik Ogilvie-Wigley
f523ac285d cargo fmt 2019-08-20 17:17:21 -06:00
Eirik Ogilvie-Wigley
cc0fc98c22 cargo fix --edition for pairing 2019-08-20 17:15:26 -06:00
Eirik Ogilvie-Wigley
bc7ea564d3 cargo fmt pairing 2019-08-15 10:38:40 -06:00
Jack Grigg
81786c24c0
Fix clippy linter errors in pairing crate 2019-08-14 01:14:05 +01:00
Jack Grigg
13933d8c51
Use modern clippy linter syntax 2019-08-14 01:14:04 +01:00
Jack Grigg
6f9083b5ab
Migrate to rand 0.7 2019-07-19 00:47:40 +02:00
Jack Grigg
83e1af104e
Migrate ff, group, pairing, and bellman to rand 0.6 2019-07-19 00:42:39 +02:00
Jack Grigg
a7e22b3550
Migrate pairing to rand 0.5 2019-07-19 00:35:06 +02:00