Commit Graph

54 Commits

Author SHA1 Message Date
bmerge
364796d88c Auto merge of #58 - ebfull:derive-clone, r=ebfull
Derive `Clone` for G1/G2 encodings.

AFAIK this will finally work on stable when the next version of Rust is released.

Closes #55
2017-10-12 16:45:21 +00:00
Sean Bowe
12b9606b9c G1/G2 rand() should produce elements of unknown exponent. 2017-10-10 01:13:35 -06:00
Sean Bowe
65e50a9e5a Allow scale_by_cofactor to be dead code temporarily. 2017-10-09 17:14:36 -06:00
Michele Orrù
e5607bb528 Add "scale_by_cofactor".
Add a function for Affine types that multiplies point by the cofactor of the
group.
2017-10-09 10:04:22 +02:00
Sean Bowe
dbac57c27b Further refactoring of get_point_from_x() 2017-10-05 12:35:04 -06:00
Sean Bowe
931257599d Refactor code for finding affine points from x-coordinates. 2017-10-04 11:43:42 -06:00
Sean Bowe
60887521b6 Derive Clone for {G1|G2}{Uncompressed|Compressed}. 2017-10-03 14:35:00 -06:00
Sean Bowe
18c75f11ab Account for negative curve parameter to be compatible with RELIC. 2017-10-03 14:27:01 -06:00
Sean Bowe
4fe3e1d6e3 Use associated constants for simple constants like these. (Closes #39.) 2017-09-28 16:08:56 -06:00
Sean Bowe
93e2a132b5 Mask rather than divn, closes #50. 2017-09-28 13:15:29 -06:00
Sean Bowe
bda22db9d5 Always recommend a window table size. 2017-09-28 08:38:13 -06:00
str4d
3ef34b750c Move benchmarks under benches/ so tests compile on stable
Closes #36.
2017-09-27 17:45:24 +01:00
str4d
39920186b3 Force public structures to implement Debug
Closes #23.
2017-09-26 15:59:50 +01:00
Michele Orrù
9846ad2d17 Some (easy) cleanups as suggested from @ebfull.
Thanks!
2017-08-24 20:13:07 +02:00
Michele Orrù
2ac2d1213d Some (easy) cleanups as suggested from @daira.
Thanks!
2017-08-23 19:17:20 +02:00
Michele Orrù
a86d0b7270 s/Q/Quadratic/ in LegendreSymbol enum.
Proposed by @ebfull.
2017-08-23 19:10:34 +02:00
Michele Orrù
6feb0f802f Merge traits SqrtField and LegendreField into SqrtField. 2017-08-23 19:08:00 +02:00
Michele Orrù
2d3f498e75 Polish sqrt in fr.rs: use pattern matching with Legendre enums. 2017-08-23 19:07:44 +02:00
Michele Orrù
57b4e73627 Create enum for LegendreSymbol, fix test. 2017-08-23 19:06:43 +02:00
Michele Orrù
1b6cf85251 Add Legendre symbol for Fq and Fq2. 2017-08-23 19:04:56 +02:00
bmerge
68747b4174 Auto merge of #34 - mmaker:fix/is_in_correct_subgroup, r=ebfull
s/is_in_correct_subgroup/is_in_correct_subgroup_assuming_on_curve/

I added a new method`is_in_correct_subgroup_assuming_on_curve` and added the method `is_in_correct_subgroup` for the `CurveAffine` trait.
2017-08-16 16:26:16 +00:00
Michele Orrù
ec49fcc638 s/is_in_correct_subgroup/is_in_correct_subgroup_assuming_on_curve/
Literelly run:
$ sed -i s/is_in_correct_subgroup/is_in_correct_subgroup_assuming_on_curve/g bls12_381/ec.rs
2017-08-16 12:08:52 +02:00
Jason Davies
b893aa17ac Remove redundant use. 2017-08-14 22:15:24 +01:00
Jason Davies
b1d981e916 Replace inline value with const. 2017-08-14 17:16:21 +01:00
Jason Davies
d2f47cfa2d Fix minor typos in comments/docs. 2017-08-14 09:47:23 +01:00
Jason Davies
21b0384f28 Fix for superscript period appearing in docs. 2017-08-14 00:22:54 +01:00
Sean Bowe
6410bdf998 Adopt idiomatic code suggestions. 2017-07-31 09:39:57 -06:00
Sean Bowe
05183c5348 Make Fq6 public. 2017-07-30 00:55:18 -06:00
Sean Bowe
053698eefb Add Engine associated type to CurveProject/CurveAffine. 2017-07-30 00:54:23 -06:00
Sean Bowe
40ec989184 Add (not particularly efficient) from_str to PrimeField. 2017-07-30 00:47:24 -06:00
Sean Bowe
dcca363d1b Add muln() to PrimeFieldRepr along with tests for muln/divn. 2017-07-29 23:20:59 -06:00
Sean Bowe
9af0c7dd30 PrimeFieldRepr::divn() should accept u32. 2017-07-29 22:50:48 -06:00
Sean Bowe
1a481bc741 PrimeField::s() should return u32. 2017-07-29 22:47:06 -06:00
Sean Bowe
41834bc4b2 Add pairing_with API. 2017-07-20 20:52:36 -06:00
Sean Bowe
176c77d602 Random encoding/decoding tests for PrimeFieldRepr. Closes #3. 2017-07-18 11:18:42 -06:00
Sean Bowe
19efad5ba6 Small fixups to reduce diff. 2017-07-18 09:17:38 -06:00
Sean Bowe
0e877810f7 Add tests for rejected encoded G1/G2 points. 2017-07-18 08:58:58 -06:00
Sean Bowe
2bfce59d8e Offer read_be and write_be utilities to simplify code, and for testing. 2017-07-18 08:58:58 -06:00
Sean Bowe
d67109d5d3 EncodedPoint should be Copy/Clone. 2017-07-18 08:58:58 -06:00
Sean Bowe
1d4710a39e Consistently use Debug and Display. 2017-07-18 08:58:58 -06:00
Sean Bowe
1027dda432 Carry the interpreted value of the encoding through the error. 2017-07-18 08:58:58 -06:00
Sean Bowe
09531d0810 Add error logic to decoding methods. 2017-07-18 08:58:58 -06:00
Sean Bowe
c618240c91 Implements and documents serialization, closes #11. 2017-07-16 20:52:00 -06:00
Sean Bowe
e72660056e Ordering cleanup for Fq/Fq2, with documentation. Closes #9. 2017-07-15 15:32:37 -06:00
Sean Bowe
806d34b39a Rename unitary_inverse to conjugate. Closes #12. 2017-07-14 11:45:07 -06:00
Sean Bowe
d438f16628 Use divn when rightshifting during rand(). 2017-07-14 11:41:40 -06:00
Sean Bowe
bafb273a6c Simplify doubling code during squaring routine. 2017-07-11 23:49:33 -06:00
Sean Bowe
647f83b53b Rename many .to_* methods to .into_*. 2017-07-11 23:37:29 -06:00
Sean Bowe
ae69eb01b3 Small adjustments to satisfy clippy. 2017-07-11 17:10:32 -06:00
Sean Bowe
3faf8c526a Encoding of G1/G2 elements in compressed or uncompressed form. 2017-07-11 15:01:31 -06:00