Pratyush Mishra
13332bcc1d
Add doctests for Boolean and UInt8.
2020-09-16 22:06:50 -07:00
Pratyush Mishra
370fbcdd3b
Document r1cs-std
2020-09-16 22:06:50 -07:00
Weikeng Chen
c21d0b2796
Add ToConstraintFieldGadget ( #278 )
2020-09-14 21:56:51 -07:00
Pratyush Mishra
40ce981801
Fix integer conversions and log2
2020-09-12 01:39:23 -07:00
Pratyush Mishra
5e00793999
Switch to tracing-based constraint debugging
2020-09-11 21:54:44 -07:00
Pratyush Mishra
d2d1b61d08
Refactor NIZK/MT verification to return a bit
2020-09-11 16:22:04 -07:00
Pratyush Mishra
6cca9327be
Refactor bit iteration infrastructure:
...
* `to_bits` -> `to_bits_le`
* `BitIterator` -> `BitIteratorLE` + `BitIteratorBE`
* `found_one`/`seen_one` -> `BitIteratorBE::without_leading_zeros`
2020-09-11 16:22:04 -07:00
Pratyush Mishra
7b0f71a10e
Refactor bit variables in r1cs-std
2020-09-11 16:22:04 -07:00
Weikeng Chen
61c70ed644
Prepare Zexe for recursion ( #241 )
...
Co-authored-by: Pratyush Mishra <pratyushmishra@berkeley.edu >
2020-07-20 15:42:25 -07:00
Pratyush Mishra
75c55f7bee
Change from_repr to output Option<Self>
2020-05-29 00:34:22 -07:00
Bruno França
bbb7d75ec8
Implement conditional_check_verify for NIZKs ( #195 )
...
* Implement `ToBitsGadget` for `UInt8` and `Vec<UInt8>`
* Add `kary_or` function to `Boolean`.
2020-04-22 13:30:33 -07:00
Kobi Gurkan
5cc094be6b
Adds alloc_constant to AllocGadget ( #189 )
...
* adds alloc constant to AllocGadget
* fmt
* fmt
* more alloc constant impls
* fmt
* even more impls
* fixes type
* fixes alloc_constant in gm17
* uses alloc_constant from field gadget in group gadgets
* fmt
* handle most comments
2020-04-18 16:03:33 -07:00
Pratyush Mishra
5659b0d9ea
Fix CI to test more code in no_std
2020-04-08 18:57:39 -07:00
Pratyush Mishra
33a9da08f8
Switch to stable cargo formatting options
2020-04-07 19:30:27 -07:00
Pratyush Mishra
456f30a849
Fix #172 and improve squaring code for deg-3 extensions ( #174 )
2020-04-07 19:29:54 -07:00
Weikeng Chen
33f7d3988f
Update uint64.rs
2020-03-26 18:50:09 -07:00
weikeng
a205f191f7
used AllocGadget for UInt64
2020-03-26 18:50:09 -07:00
Pratyush Mishra
b1913a9ca7
Change default to_bits and to_bytes functions to the safe versions
2020-03-18 23:24:54 -07:00
ValarDragon
20af44e3c9
fix fmt check
2020-03-12 09:21:01 -07:00
ValarDragon
23c6bb4bd0
Rename arguments to CondSelectGadget for code clarity
2020-03-12 09:21:01 -07:00
Weikeng Chen
6c0ee7ffbc
Follow the nightly's suggested fmt change
2020-03-05 10:55:54 -08:00
weikeng
e524e46d0b
Add UInt64 used for representing Merkle tree node locations
2020-03-05 10:55:54 -08:00
Pratyush Mishra
0df0a15e1b
Blake PRF & R1CS Boolean Refactor ( #132 )
...
* refactor(r1cs-std/boolean): expose enforcing value less than functionality
* fix(r1cs-std/boolean): ensure num_bits is calculated correctly from the arg
* feat(primitives/blake2s): allow creating Blake2s with custom params
2020-03-05 10:51:59 -08:00
Pratyush Mishra
8bf042a029
Refactor algebra API, split into algebra and algebra-core. ( #100 )
2020-02-26 21:42:04 -08:00
Marek Kotewicz
9621bd34a4
r1cs-std works with no-std ( #92 )
2020-02-05 13:55:38 -08:00
François Garillot
b26867f267
Runs rustfmt on the repo
2020-01-27 11:44:23 -08:00
Pratyush Mishra
a3e1cd6cf2
Make libraries compile
2020-01-19 21:12:07 -08:00
Pratyush Mishra
40cf13b7b8
num_traits:: -> algebra::
2020-01-18 18:26:45 -08:00
François Garillot
722a901ae7
[RFC] Convert identity functions in Field, Group, and {Projective,Affine}Curve traits with One/Zero traits from num_traits.
...
- contributes to #50 ,
- depends on #53 and builds on it,
- due to coherence & requirements of `num_traits::{Zero, One}` to implement `std::ops::Add<Self, ..>` and (resp.) `std::ops::Mul<Self, ..>`, I've had to replace the afferent `impl<'a, P: ..> (Add|Mul)<&'a Self> for Group(Affine|Projective)<P>` by direct implementations on `Self`,
- I did not have to fight the borrow checker for this conversion => I think this hints arithmetic operations are called in contexts where the operand is owned,
- hence should this end up on a merge track, we may want to open an issue to convert the `impl<'a, P:..> (Neg|Sub|..)<&'a Self> for ..<P>` trait usage to direct `impl<P:..> (Neg|Sub|..)<Self> for ..<P>`
- the `impl AddAssign for GroupAffine<P>` in curves/models/short_weierstrass_jacobian.rs is provided to fit trait bounds, and without any guarantee of suitability for any particular purpose
- and that, even though I don't think it's used.
2020-01-17 11:22:41 -08:00
Pratyush Mishra
2a8974e442
Boolean conditional select
2019-12-18 06:35:57 +03:00
François Garillot
f1d8b122fc
Use operator syntax
...
eliminate a few redundant references
2019-12-02 09:54:14 -08:00
François Garillot
b42d5f8d36
Simplify a few "if" structures
2019-12-02 09:54:14 -08:00
François Garillot
53a51eb4dc
Use built-in iteration functions more
2019-12-02 09:54:14 -08:00
François Garillot
d71bc5a675
Prefer to return error rather than ? them,
...
avoid return when it cant be early (in a simple if-else)
2019-12-02 09:54:14 -08:00
François Garillot
10c6e85c1a
Remove a few unnecessary .into_iter() explicit calls, and some cloning.
...
See https://rust-lang.github.io/rust-clippy/master/#explicit_into_iter_loop
2019-12-02 09:54:14 -08:00
Kobi Gurkan
581f3df55f
Adds Bowe-Hopwood hash
2019-11-17 09:07:23 -08:00
Pratyush Mishra
a244e719d1
Initial commit to extract crypto-primitives to new crate
2019-10-11 19:25:53 -07:00
Pratyush Mishra
0a507b0a5f
Upgrade ff-fft, gm17, and r1cs-std
2019-09-17 01:35:23 -07:00
Pratyush Mishra
c610ecbcc5
Update r1cs-std tests
2019-08-14 13:13:33 +03:00
Pratyush Mishra
e00d667330
Move snark-gadgets to r1cs-std
2019-08-14 13:13:33 +03:00