Commit Graph

1267 Commits

Author SHA1 Message Date
Sean Bowe
031ae638ce
Tidy up the codebase (TODOs into github issues). 2017-12-18 22:08:57 -07:00
ebfull
49cc4e05d9
Merge pull request #4 from ebfull/refactor-jubjub
Group Hash implementation in the circuit
2017-12-18 21:38:30 -07:00
Sean Bowe
1e56289f19
Implementation of group hash in the circuit. 2017-12-18 11:34:15 -07:00
Sean Bowe
d143d3230a
Relocate grouphash implementation. 2017-12-18 11:15:02 -07:00
Jay Graber
635bd8104e
Add grouphash 2017-12-18 10:58:59 -07:00
Sean Bowe
7d6a57661b
Add Montgomery point interpretation. 2017-12-17 10:07:00 -07:00
Sean Bowe
eb8803f9eb
Implementation of into_bits_strict for Num. 2017-12-17 09:31:33 -07:00
Sean Bowe
068fbbc2be
Implementation of into_bits for Num. 2017-12-17 09:12:04 -07:00
Sean Bowe
6c6a193551
Implementation of from_bits_strict for Num. 2017-12-16 17:03:40 -07:00
Sean Bowe
d04c5acdb8
Implement enforce_in_field and enforce_nand for Boolean. 2017-12-16 16:01:13 -07:00
Sean Bowe
dfd82439de
Implementation of k-ary AND. 2017-12-15 14:12:38 -07:00
Sean Bowe
dc981e6abc Allow linear combinations to be added together. 2017-12-14 16:11:24 -07:00
Sean Bowe
46cbfb4831
Implementation of Montgomery point doubling in the circuit. 2017-12-14 15:41:37 -07:00
Sean Bowe
8c4433ee82
Add 2A precomputation to jubjub parameters. 2017-12-14 11:34:57 -07:00
Sean Bowe
6b43a4ed10
Make UInt32::addmany produce constant results when fed constant inputs, to allow for blake2s block precomputation for group hash. 2017-12-12 14:53:16 -07:00
Sean Bowe
3a6e8d448f
Add get_for_x to Montgomery implementation. 2017-12-12 10:31:13 -07:00
Sean Bowe
e9d3923829
Refactor jubjub implementation to be abstract over field, parameters. 2017-12-11 23:06:05 -07:00
ebfull
bba5797e72
Merge pull request #2 from ebfull/mont-to-projective
Do not perform inversions when converting from montgomery to edwards
2017-12-11 15:44:11 -07:00
Sean Bowe
c0f5645ab4
Do not perform inversions when converting from Montgomery to projective extended twisted Edwards. 2017-12-06 17:22:35 -07:00
Sean Bowe
7c48792511
Some test cleanups. 2017-12-06 10:21:56 -07:00
Sean Bowe
bcb4925c6d
Rename "sapling" to "sapling-crypto" in COPYRIGHT. 2017-12-06 10:15:12 -07:00
Sean Bowe
96bcc84447
Change library name and add README. 2017-12-06 10:10:56 -07:00
Sean Bowe
86619c7334
Implementation of fundamental circuitry and primitive Jubjub curve arithmetic. 2017-12-06 10:06:34 -07:00
bmerge
a8583dd818 Auto merge of #71 - ebfull:expose-arith, r=ebfull
Expose arithmetic

This exposes `adc`/`sbb`/`mac_with_carry` from this library for downstream use, as long as a `expose-arith` feature is enabled. We need this downstream to avoid code duplication.

This also bumps to `0.13.2`.
2017-12-05 04:43:24 +00:00
Sean Bowe
fb679470db
Bump version. 2017-12-04 21:48:22 -07:00
Sean Bowe
04a32fb443
Introduce expose-arith unstable feature for exposing arithmetic functions downstream. 2017-12-04 21:47:45 -07:00
Sean Bowe
70a588ceee Version bump 2017-12-02 23:31:37 -07:00
ebfull
3163e801b9
Merge pull request #16 from ebfull/recode
Part one of recoding bellman
2017-12-02 23:30:57 -07:00
Sean Bowe
5a88b4f818 Guarantee inheritance of variable type for public constraint system contexts. 2017-12-02 23:30:23 -07:00
bmerge
cc8be5b780 Auto merge of #70 - ebfull:comment-fixes, r=ebfull
Fix some comments

The `mod q` stuff was spotted by @Pratyush and/or @howardwu.

I just noticed the `// 2` typo.
2017-11-26 10:19:09 +00:00
Sean Bowe
b8394bf14d
Fix some comments. 2017-11-26 03:09:06 -07:00
bmerge
ed5a7f31e2 Auto merge of #69 - ebfull:0.13.1-release, r=ebfull
Release of 0.13.1

This release features the following changes:

* The `byteorder` version is now set to `1` as conventional.
* The `CurveAffine`/`CurveProjective` traits now enforce that the scalar field of the `Engine` is the same scalar field for the curves.
* `Engine` is now `'static` and `Clone` to avoid problems with lifetime quirks and auto-derives.
* The scalar field of `Engine` is now guaranteed to be `SqrtField` which helps downstream abstractions.

In this PR I will be updating the `clippy` version and fixing any linting problems that show up. The builder should be using the newest nightly/stable versions of Rust also.
2017-11-26 04:27:58 +00:00
Sean Bowe
bb1ced0bd7
Update clippy version. 2017-11-25 21:32:14 -07:00
Sean Bowe
566f100480
Release of 0.13.1. 2017-11-25 21:01:55 -07:00
bmerge
df9d2aaa37 Auto merge of #68 - ebfull:scalar-sqrt, r=ebfull
Scalar field should be guaranteed to be SqrtField
2017-11-26 03:50:21 +00:00
Sean Bowe
aa0cc06e5e
Scalar field should be guaranteed to be SqrtField. 2017-11-25 20:57:10 -07:00
Sean Bowe
1fc640e88f Guarantee that we inherit the correct variable type. 2017-11-24 10:14:11 -07:00
Sean Bowe
92029393f6 Guarantee that variables are Copy+Clone. 2017-11-22 22:55:32 -07:00
Sean Bowe
1d394e00f6 Allow linear combination terms to be inspected for downstream evaluation. 2017-11-22 21:11:41 -07:00
Sean Bowe
e54c4bc1b3 Rename to namespace_public. 2017-11-21 14:00:00 -07:00
Sean Bowe
af91dcda33 Infrastructure for public input namespacing. 2017-11-21 13:44:56 -07:00
Sean Bowe
b7f2f9e409 Part one of Bellman being recoded. 2017-11-21 01:59:49 -07:00
bmerge
affead11a5 Auto merge of #67 - ebfull:static-engine, r=ebfull
Engine should always be 'static, for flexibility in downstream code.
2017-11-21 06:47:28 +00:00
Sean Bowe
4a1ac94799
Implement Clone for Bls12. 2017-11-20 23:53:58 -07:00
Sean Bowe
4b366a143d
Ensure Engine's are always Clone. 2017-11-20 23:20:11 -07:00
Sean Bowe
6d55a4052a Move everything into oldsrc. 2017-11-20 23:01:15 -07:00
Sean Bowe
945d86fe7d Make the namespacing not introduce too much indirection. 2017-11-20 15:50:41 -07:00
bmerge
36ad8b672c Auto merge of #66 - ebfull:scalar-assoc, r=ebfull
Enforce that Fr of Engine is the scalar for curve points

In bellman, I want to write:

```rust
pub struct Point<C: CurveProjective>(pub C);

impl<C: CurveProjective> Copy for Point<C> { }

impl<C: CurveProjective> Clone for Point<C> {
    fn clone(&self) -> Point<C> {
        *self
    }
}

impl<C: CurveProjective> Group<C::Engine> for Point<C> {
    fn group_zero() -> Self {
        Point(C::zero())
    }
    fn group_mul_assign(&mut self, by: &C::Scalar) {
        self.0.mul_assign(by.into_repr());
    }
    fn group_add_assign(&mut self, other: &Self) {
        self.0.add_assign(&other.0);
    }
    fn group_sub_assign(&mut self, other: &Self) {
        self.0.sub_assign(&other.0);
    }
}
```

However, this doesn't typecheck because the compiler cannot know that the `Engine`'s `Fr` type (as dictated by the `Group` trait) is the same as the `Scalar` type of the `CurveProjective` point. This can be solved with a where bound over the trait (for now), but it is generally a good idea for this to be constrained in `pairing`.
2017-11-20 19:26:16 +00:00
Sean Bowe
f32cb40929
Engine should always be 'static, for flexibility in downstream code. 2017-11-20 12:22:51 -07:00
Sean Bowe
a1e1aa30b5 More infrastructure for test development. 2017-11-18 20:10:47 -07:00