Commit Graph

92 Commits

Author SHA1 Message Date
36dc14e6ff Use barycentric Lagrange interpolation in all cases.
While this is a slight regression in performance in the case
where k < 5, in absolute terms it is small enough to be neglible.
2018-08-13 21:29:39 +02:00
e767f28d4c Initial barycentric Langrange interpolation
Implements barycentric Lagrange interpolation. Uses algorithm (3.1) from the
paper "Polynomial Interpolation: Langrange vs Newton" by Wilhelm Werner to find
the barycentric weights, and then evaluates at `Gf256::zero()` using the second
or "true" form of the barycentric interpolation formula.

I also earlier implemented a variant of this algorithm, Algorithm 2, from "A new
efficient algorithm for polynomial interpolation," which uses less total
operations than Werner's version, however, because it uses a lot more
multiplications or divisions (depending on how you choose to write it), it runs
slower given the running time of subtraction/ addition (equal) vs
multiplication, and especially division in the Gf256 module.

The new algorithm takes n^2 / 2 divisions and n^2 subtractions to calculate the
barycentric weights, and another n divisions, n multiplications, and 2n
additions to evaluate the polynomial*. The old algorithm runs in n^2 - n
divisions, n^2 multiplications, and n^2 subtractions. Without knowing the exact
running time of each of these operations, we can't say for sure, but I think a
good guess would be the new algorithm trends toward about 1/3 running time as n
-> infinity. It's also easy to see theoretically that for small n the original
lagrange algorithm is faster. This is backed up by benchmarks, which showed for
n >= 5, the new algorithm is faster. We can see that this is more or less what
we should expect given the running times in n of these algorithms.

To ensure we always run the faster algorithm, I've kept both versions and only
use the new one when 5 or more points are given.

Previously the tests in the lagrange module were allowed to pass nodes to the
interpolation algorithms with x = 0. Genuine shares will not be evaluated at x =
0, since then they would just be the secret, so:

1. Now nodes in tests start at x = 1 like `scheme::secret_share` deals them out.
2. I have added assert statements to reinforce this fact and guard against
   division by 0 panics.

This meant getting rid of the `evaluate_at_works` test, but
`interpolate_evaluate_at_0_eq_evaluate_at` provides a similar test.

Further work will include the use of barycentric weights in the `interpolate`
function.

A couple more interesting things to note about barycentric weights:

* Barycentric weights can be partially computed if less than threshold
  shares are present. When additional shares come in, computation can resume
  with no penalty to the total runtime.
* They can be determined totally independently from the y values of our points,
  and the x value we want to evaluate for. We only need to know the x values of
  our interpolation points.
2018-08-13 21:29:39 +02:00
f2a95add48 Small Rustfmt formatting fix to build.rs 2018-08-13 21:29:39 +02:00
910479f698 Start next development iteration 0.2.3-pre. 2018-05-17 10:53:01 +02:00
bdeb36d6d1 Release version 0.2.2. 2018-05-17 10:52:13 +02:00
a69d61dfbc Pin protobuf to >=1.4 && <1.6. Fixes #67 2018-05-17 10:37:05 +02:00
c112f7920b Start next development iteration 0.2.2-pre. 2018-03-08 00:41:31 +01:00
0148317495 Bump version to 0.2.1 2018-03-08 00:40:13 +01:00
e6ed97b7d7 Update changelog 2018-03-08 00:39:56 +01:00
9c123a900d Implement {Add, Div, Mul, Sub}Assign for Gf256 2018-03-06 13:45:48 +01:00
3de16890a4 Fix bug where threshold did not set deg of secret polynomial
Fixes #43.

Fixes a syntactic error. Threshold should determine the number of coefficients
in the secret polynomial. As is the code is equivalent to threshold always being
2.
2018-03-03 17:02:42 +01:00
3e89d1b1ca Add a test for issue #43.
Regardless of threshold, all polynomials are lines due to small syntactic error
2018-03-03 17:01:55 +01:00
7f9289eb1a Exclude protobuf-generated files from coverage report 2018-02-17 13:46:31 +01:00
efba922785 Configure kcov and coveralls.io 2018-02-16 17:03:39 +01:00
f5213706eb Update badges in README and fix CHANGELOG 2018-02-13 22:15:12 +01:00
13095ee690 Start next development iteration 0.1.1-pre. 2018-02-13 21:59:02 +01:00
1fbff5111f Release version 0.1.0. 2018-02-13 20:54:00 +01:00
474756e830 Remove generated documentation
The latest documentation will now be found in the `gh-pages` branch.
2018-02-13 20:48:41 +01:00
cd84c3f5bb Add a changelog 2018-02-13 20:45:36 +01:00
acccd3316f Bump version to 0.1.0-pre 2018-02-13 20:44:50 +01:00
f65b4d1e11 Update authors 2018-02-13 20:44:50 +01:00
e28acab43c Add Cargo.lock to .gitignore
See https://doc.rust-lang.org/cargo/faq.html#why-do-binaries-have-cargolock-in-version-control-but-not-libraries for more information.
2018-02-13 20:38:31 +01:00
881ad146f2 Remove warning in README 2018-02-13 20:31:26 +01:00
9b2ac6b9cd Fix hidden docs 2018-02-13 20:31:26 +01:00
2569e1b27a Hide proto::dss module under dss feature flag 2018-02-13 20:31:26 +01:00
e9b0f61c6c Configure cargo-release 2018-02-13 14:47:36 +01:00
40f6190a9b Preliminary implementation of deterministic secret sharing
#32
2018-02-11 22:17:07 +01:00
d857157efd Fix typo + feedback from @dtsbourg 2017-10-18 14:15:19 +02:00
a9e942a41a Add PR warning to the README 2017-10-18 13:46:28 +02:00
02c88e0164 Add link to documentation for latest release. 2017-08-20 14:34:55 +02:00
62e311ce7f Bump merkle_sigs to 1.2.1 2017-08-04 18:14:56 +02:00
2d39c5950b Update documentation. 2017-08-04 18:14:56 +02:00
cb44533c62 wrapped_secrets::generate_shares: make MIME type optional. 2017-08-04 18:14:56 +02:00
d3daa6825e Update ring to v0.11.0 and merkle_sigs to HEAD 2017-08-03 17:03:00 +02:00
1e5626ef14 Bump dependencies (#22) 2017-02-16 00:19:04 +01:00
4eea651414 Fixes for share groups (#21)
* Fix for recovery with n of shares > k with share_groups.

* Cargo updates.
2017-02-13 00:06:13 +00:00
92b4b75096 Adding bug report policy. 2017-01-05 21:50:00 +01:00
4f6928ff99 Adding info in the README about signatures. 2017-01-05 21:36:49 +01:00
4b73faf3e4 Support for wrapped_secrets containing versioning and MIME info. 2017-01-05 20:57:10 +01:00
ef4d525703 Adding share_num field to errors. 2016-12-20 23:10:47 +01:00
f5ab309dd6 Refactoring to allow for a more flexible API. 2016-12-02 14:56:12 +01:00
aeb8e4c21f New share format. (#13)
* Removing Coverall support until fixed. (See #12)

* Changing Cargo license.

* New wrapping of share data to support signatures.
2016-11-18 12:34:06 +01:00
6ad30652a6 Fixing URLs in README. 2016-11-10 22:46:54 +01:00
1735274450 Add license. 2016-11-09 22:45:30 +01:00
36d6ad89fb Warning in README.md (#7) 2016-04-13 23:45:11 +02:00
7f6db55452 Some simplifications.
- Removes inv from table (not used).
- Removes 2nd argument from Lagrange interpolation (is always zero).
2016-04-11 16:42:13 +02:00
0966bbbc3d Fixing typos & adopting std::process::exit.
* Minor changes (typos, keep up with rust stable) while skimming through the code
* Minor changes: s/secretshare/rustysecrets in usage string
2016-04-09 20:35:53 +02:00
3767677b9d Fixed some clippy warnings.
Closes #4
2016-04-08 23:32:24 +02:00
62755d6024 README.md tweaks. 2016-04-08 19:15:56 +02:00
a52bf5fff1 Basic documentation.
Closes #1.
2016-04-07 02:01:40 +02:00