str4d
5ff8562744
Merge pull request #222 from adityapk00/zecwallet_compat
...
Expose the `hash` and `n` fields of Transparent Outputs
2020-05-23 14:13:31 +12:00
Aditya Kulkarni
4b1d8e5226
Add methods to get OutPoint n, hash
2020-05-22 18:02:44 -07:00
str4d
121231199c
Merge pull request #205 from str4d/taddr-encoding
...
Implement TransparentAddress encoding and decoding
2020-05-23 12:22:01 +12:00
str4d
8831150825
Merge pull request #232 from str4d/lint-fixes
...
Lint fixes
2020-05-23 08:03:03 +12:00
Jack Grigg
c488732022
Use text directive on sage script doc comment instead of norun
...
norun is an invalid directive, and no_run would cause the sage script to
be compiled as Rust.
2020-05-22 19:13:33 +12:00
Jack Grigg
2892cf94c1
Migrate to protobuf-codegen-pure 2.14
2020-05-22 18:55:46 +12:00
Jack Grigg
4edff96321
Fix various lints
2020-05-22 18:52:35 +12:00
str4d
a22957b575
Merge pull request #231 from str4d/group-remove-encodedpoint
...
group: CurveAffine and CurveProjective trait refactor
2020-05-21 09:49:34 +12:00
Jack Grigg
5f1607c9b5
group: Rename into_*(&self) -> to_*(&self)
...
Rust naming convention uses the into_ prefix for methods that consume
self, and the to_ prefix for methods that take an immutable reference.
2020-05-20 11:32:12 +12:00
Jack Grigg
ceecd32ac4
group: Remove EncodedPoint::from_affine
...
The EncodedPoint trait is replaced by explicit bounds on the
CurveAffine::{Uncompressed, Compressed} associated types.
2020-05-20 11:32:12 +12:00
Jack Grigg
b77f8dddda
group: Remove EncodedPoint::{into_affine, into_affine_unchecked}
...
Replaced by explicit APIs on the CurveAffine trait.
GroupDecodingError has been moved into pairing::bls12_381::ec, as it is
no longer used by the group traits.
2020-05-20 11:32:12 +12:00
Jack Grigg
b0a3713d7e
group: Add mixed-addition scalar multiplication bounds to CurveAffine
...
Replaces the explicit CurveAffine::mul trait method.
2020-05-20 11:32:12 +12:00
Jack Grigg
0941dddc13
group: Return subtle::Choice from CurveAffine::is_identity
2020-05-20 11:32:12 +12:00
Jack Grigg
b94d567076
group: Direct-to-affine CurveProjective::batch_normalize
...
Replaces the mutating CurveProjective::batch_normalization API, and
removes the need for CurveProjective::is_normalized.
The new temporary implementation in pairing::bls12_381::ec is adapted
from bls12_381::g1.
2020-05-20 11:32:12 +12:00
str4d
4969ad4d93
Merge pull request #230 from str4d/group-trait
...
group crate refactoring
2020-05-19 08:30:53 +12:00
Jack Grigg
669f2b43eb
group: Return subtle::Choice from Group::is_identity
2020-05-15 10:24:30 +12:00
Jack Grigg
ec88778258
group: Add scalar multiplication bounds to Group
...
The Scalar associated type is moved from CurveProjective to Group.
2020-05-15 10:24:30 +12:00
Jack Grigg
0df950dc0d
group: Add Group::Subgroup associated type
...
For prime-order groups, this may be Self.
2020-05-15 00:20:32 +12:00
Jack Grigg
d2aa87f084
group: Move CurveProjective::double to Group
2020-05-15 00:20:32 +12:00
Jack Grigg
e3d84280b9
group: Sum + for<'a> Sum<&'a Self> bounds for Group
2020-05-15 00:20:32 +12:00
Jack Grigg
5397d73e0b
group: Define group operations on Group trait
...
The GroupOps trait represents the group operation (addition), and the
combination of the group operation with group inversion (subtraction).
Group inversion (negation) is constrained directly on the Group trait.
2020-05-15 00:20:32 +12:00
Jack Grigg
69f53febcf
group: Introduce Group and PrimeGroup traits
...
Group represents a cryptographic group with a large prime-order subgroup
and a small cofactor. PrimeGroup further constrains the group to have a
cofactor of one.
2020-05-15 00:20:32 +12:00
Jack Grigg
7203a7a30a
Remove Engine associated type from CurveAffine and CurveProjective
...
The type Curve*::Engine::Fr is equivalent to Curve*::Scalar, making
Engine a redundant associated type.
2020-05-15 00:20:32 +12:00
Jack Grigg
8add78a327
Make CurveProjective::double take &self and return Self
2020-05-15 00:20:32 +12:00
Jack Grigg
4f2220fbb1
group: Rename zero and one to identity and generator
2020-05-15 00:20:32 +12:00
Jack Grigg
d7d49285d8
Remove explicit std::marker from Sized bound
...
Sized is always part of the prelude, and binding on std causes
compilation issues for no-std crates.
2020-05-15 00:20:32 +12:00
str4d
41d9f293d4
Merge pull request #229 from therealyingtong/106-hardcode-sapling-circuit-hashes
...
Hard-code Sapling circuit hashes in zcash_proofs crate
2020-05-14 17:06:07 +12:00
Jack Grigg
f446b45af5
cargo fmt
2020-05-14 16:06:58 +12:00
ying tong
6845154d88
Update zcash_proofs/src/lib.rs
...
Co-authored-by: str4d <thestr4d@gmail.com>
2020-05-14 11:30:13 +08:00
therealyingtong
d480a3840a
Hard-code Sapling circuit hashes in zcash_proofs crate
...
Define the spend_hash, output_hash, sprout_hash circuit hashes as constants in the load_parameters function, so we don't have to take them as function arguments.
2020-05-13 22:36:21 +08:00
str4d
37270776be
Merge pull request #228 from str4d/ff-more-trait-refactoring
...
ff: More trait refactoring
2020-05-13 09:18:11 +12:00
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
fb31d09218
ff: Remove Ord bound from PrimeField
...
ff_derive still implements Ord and PartialOrd for the fields it
implements, because pairing::bls12_381 internally assumes that those are
implemented. Once we delete that implementation, we will remove the Ord
and PartialOrd implementations from ff_derive.
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
str4d
b02cf3b467
Merge pull request #223 from str4d/remove-primefieldrepr
...
Remove ff::PrimeFieldRepr
2020-05-01 08:59:41 +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
1fe3e3784c
ff: Add Ord bound to PrimeField
2020-04-23 17:31:33 +12:00
Jack Grigg
1a40cfd39c
zcash_primitives: Make jubjub::Fs::invert constant time
2020-04-23 16:23:24 +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
str4d
b82dac13d9
Merge pull request #221 from adityapk00/binding_sig
...
Add binding signature only if needed
2020-04-16 13:46:26 +12:00
Aditya Kulkarni
3ccadf3017
Add binding signature only if needed
2020-04-04 10:29:30 -07: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
69c60530d4
group: Rewrite wNAF to remove dependency on ff::PrimeFieldRepr
...
Adapted from Scalar::non_adjacent_form in curve25519-dalek.
2020-03-26 22:32:17 +13:00