Commit Graph

205 Commits

Author SHA1 Message Date
Pratyush Mishra
73ac661ddf Update CHANGELOG 2021-03-24 14:00:57 +03:00
Pratyush Mishra
53b2ac48fa Fix UInt docs 2021-03-24 14:00:57 +03:00
dependabot-preview[bot]
fc44ff2de7 Update num-bigint requirement from 0.3 to 0.4
Updates the requirements on [num-bigint](https://github.com/rust-num/num-bigint) to permit the latest version.
- [Release notes](https://github.com/rust-num/num-bigint/releases)
- [Changelog](https://github.com/rust-num/num-bigint/blob/master/RELEASES.md)
- [Commits](https://github.com/rust-num/num-bigint/compare/num-bigint-0.3.0...num-bigint-0.4.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2021-03-24 11:03:45 +03:00
Elder Ryan
a1e72154bf fixed link format (#54) 2021-02-21 08:58:59 -08:00
Tom Shen
09f3613aac Add DensePolynomialVar (#50)
* add folder structures similar to `ark-poly`

* add evaluate impl for DensePolynomialVar

* add tests

* fix no-std

* use ark_std::rand instead of SeedableRng

* add changelog

Co-authored-by: Weikeng Chen <w.k@berkeley.edu>
2021-02-04 17:12:23 -08:00
Weikeng Chen
b741ffc33d replace rand with ark_std::rand and drop rand_xorshift (#51) 2021-02-04 14:24:29 -08:00
Dev Ojha
1f83ffdff4 Switch to panic='abort' for safety across FFI boundaries (#47)
Co-authored-by: Pratyush Mishra <pratyushmishra@berkeley.edu>
2021-02-04 14:04:55 -08:00
Tom Shen
05fee34686 Add Mux gadget (#48) 2021-02-04 13:52:29 -08:00
Kobi Gurkan
a8f737bf26 Fix boolean or comment (#44) 2021-01-27 00:46:13 -08:00
Pratyush Mishra
d9e0200433 Improve handling of constant bits in scalar mul for SW curves (#43)
* We add a double_and_add method that computes 2 * self + other more
  efficiently than just doubling + addition; this is not used anywhere 
  yet, but I am planning on fiddling with it to see if we can leverage
  it somehow. (See zcash/zcash#3924 for details)

* We handle constant scalars better:
  * We skip the most-significant constant zeroes to avoid unnecessary
    doubling
  * When intermediate bits of the scalar are constants, instead of
    conditionally adding, we directly use the value of the bit to
    decide whether to add or not.


Co-authored-by: Dev Ojha <ValarDragon@users.noreply.github.com>
Co-authored-by: weikeng <w.k@berkeley.edu>
2021-01-22 14:55:55 -08:00
Pratyush Mishra
5e4114b19c Better scalar multiplication for Short Weierstrass curves (#40)
Co-authored-by: Dev Ojha <ValarDragon@users.noreply.github.com>
Co-authored-by: Pratyush Mishra <pratyushmishra@berkeley.edu>
2021-01-15 13:18:26 -08:00
Dev Ojha
f88d7c6ea3 Make mul_by_inverse use one constraint (#42)
Co-authored-by: Pratyush Mishra <pratyushmishra@berkeley.edu>
2021-01-15 10:55:26 -08:00
Dev Ojha
bdc9fbbf30 Add changelog and .github issue templates (#39)
* Add changelog and .github issue templates
2021-01-14 12:01:40 -06:00
William Lin
2432ff4f88 Implement ToConstraintFieldGadget for Vec<UInt8> (#36)
* Implement ToConstraintFieldGadget for Vec<UInt8>

* Add documentation and implementation for slice

* Update documentation
2021-01-11 23:56:40 -08:00
Pratyush Mishra
20bd452cd9 Construct FpVar from bits (#35) 2021-01-11 16:24:39 -08:00
Pratyush Mishra
0162ef18bc More efficient scalar multiplication for Short Weierstrass curves (#33)
* When a group element is a constant, precompute multiples of powers of two, and perform simple conditional additions (no doubling!).
* For short weierstrass curves, addition with a constant now uses mixed addition, which results in lower constraint weight.
* For short weierstrass curves, scalar multiplication now uses mixed addition, saving 1 constraint per bit of the scalar, along with lower constraint weight (at the cost of a small constant number of constraints to check for edge cases)
2021-01-10 13:18:11 -08:00
Pratyush Mishra
262fac3e83 Loosen restrictions 2021-01-08 21:21:32 -08:00
Pratyush Mishra
a44643ed76 Fix mul_by_inverse for constants 2021-01-08 21:21:32 -08:00
Pratyush Mishra
f52b866e59 Fix documentation links (#28) 2020-12-23 21:46:02 -06:00
Pratyush Mishra
1e935b0b94 Fix to_non_unique_bytes for BLS12::G1Prepared 2020-12-16 10:46:02 -08:00
Pratyush Mishra
9cb17dc130 Fix links in Cargo.tomls 2020-12-15 13:10:03 -08:00
Pratyush Mishra
0fd45d3d83 Reduce allocations in UInts 2020-12-08 23:13:33 -08:00
jon-chuang
905e7284b2 Reduce density of ThreeBitCondNegLookup 2020-11-25 00:26:32 -08:00
Weikeng Chen
68f08b94d2 Add UInt128 for u128 (#21) 2020-11-23 15:26:10 -08:00
Nirvan Tyagi
77dfd7dac6 'cargo +stable fmt' 2020-11-20 18:38:25 -08:00
Nirvan Tyagi
45a4c3b326 'cargo fmt' 2020-11-20 18:38:25 -08:00
Nirvan Tyagi
957ac48da4 Apply suggestions from code review
Co-authored-by: Pratyush Mishra <pratyushmishra@berkeley.edu>
2020-11-20 18:38:25 -08:00
Nirvan Tyagi
0abb3a7dfe CondSelectGadget for UInts 2020-11-20 18:38:25 -08:00
Weikeng Chen
edc9a8ce02 Allow CS being none for into_edwards (#16)
* allow cs being none for into_edwards
2020-11-16 01:39:07 -08:00
Weikeng Chen
18824c0c83 Allow CS being none for into_edwards (#15) 2020-11-16 00:11:35 -08:00
Weikeng Chen
f4691621ee Add ToConstraintFieldGadget for ProjectiveVar (#13) 2020-11-12 01:41:59 -08:00
Weikeng Chen
8dca325042 Make ToBitsGadget for FpVar's output constant-length (#12)
This is related to a Zexe issue https://github.com/scipr-lab/zexe/issues/289

Basically, ToBitsGadget for FpVar may produce shorter output for a constant value, which is undesired for a few reasons.
2020-11-12 01:18:43 -08:00
Pratyush Mishra
6077f51c97 *Actually* fix to_affine for SW points.
The prior PR (#9) multiplied by `self.z` instead of `self.z.inverse()`.
2020-11-11 23:14:25 -08:00
Pratyush Mishra
ceec513f62 Fix SW to_affine (#9)
Adds constraints to check that the conversion to affine coordinates happened correctly.
2020-11-10 10:46:44 -08:00
Kobi Gurkan
e5ec2e66d3 fix: fix wrong constant case detection in three_bit_cond_neg_lookup 2020-10-30 15:40:15 -07:00
Pratyush Mishra
e5ac1f44cb Remove rustc-version 2020-10-29 08:39:32 -07:00
yelhousni
2e2df52f79 replace frob(6) by unitary_inverse in bls12 2020-10-21 08:01:31 -07:00
Pratyush Mishra
636f93a3e5 Update to arkworks libraries (#3)
Co-authored-by: Nicholas Ward <npward@berkeley.edu>
2020-10-19 11:07:59 -07:00
Pratyush Mishra
cf4301cb75 Update workspace and dependency paths 2020-09-18 16:09:13 -07:00
oblivious-app
d087166c51 add to_bits_be 2020-09-18 08:40:34 -07:00
Pratyush Mishra
2a8ee871d8 Exclude benches from tests 2020-09-16 23:59:23 -07:00
Pratyush Mishra
99e489cac7 R1CSVar: Option::None -> ConstraintSystemRef::None (#281) 2020-09-16 23:09:41 -07:00
Pratyush Mishra
13332bcc1d Add doctests for Boolean and UInt8. 2020-09-16 22:06:50 -07:00
Pratyush Mishra
3a18ecee0d Add examples and doctests for instantiated curves 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
e22ab36f7e Fix nits 2020-09-11 16:22:04 -07:00
Pratyush Mishra
d2d1b61d08 Refactor NIZK/MT verification to return a bit 2020-09-11 16:22:04 -07:00