#shamir #secret #sharing #share #crypto

sharks

Fast, small and secure Shamir’s Secret Sharing library crate

10 unstable releases (3 breaking)

0.4.2 Aug 3, 2020
0.4.1 Apr 24, 2020
0.3.3 Mar 23, 2020
0.3.1 Feb 27, 2020
0.1.1 Jan 13, 2020

#139 in Cryptography

Download history 61/week @ 2020-06-06 191/week @ 2020-06-13 204/week @ 2020-06-20 532/week @ 2020-06-27 896/week @ 2020-07-04 78/week @ 2020-07-11 97/week @ 2020-07-18 305/week @ 2020-07-25 116/week @ 2020-08-01 79/week @ 2020-08-08 66/week @ 2020-08-15 63/week @ 2020-08-22 309/week @ 2020-08-29 93/week @ 2020-09-05 95/week @ 2020-09-12 81/week @ 2020-09-19

947 downloads per month
Used in 3 crates

MIT/Apache

30KB
413 lines

Sharks

Rust Crates Docs Codecov License

Fast, small and secure Shamir's Secret Sharing library crate

Documentation:

Usage

Add this to your Cargo.toml:

[dependencies]
sharks = "0.4"

If your environment doesn't support std:

[dependencies]
sharks = { version = "0.4", default-features = false }

To get started using Sharks, see the Rust docs

Features

Developer friendly

The API is simple and to the point, with minimal configuration.

Fast and small

The code is as idiomatic and clean as possible, with minimum external dependencies.

Secure by design

The implementation forbids the user to choose parameters that would result in an insecure application, like generating more shares than what's allowed by the finite field length.

Limitations

Because the Galois finite field it uses is GF256, only up to 255 shares can be generated for a given secret. A larger number would be insecure as shares would start duplicating. Nevertheless, the secret can be arbitrarily long as computations are performed on single byte chunks.

Testing

This crate contains both unit and benchmark tests (as well as the examples included in the docs). You can run them with cargo test and cargo bench.

Benchmark results [min mean max]

CPU obtain_shares_dealer step_shares_dealer recover_secret share_from_bytes share_to_bytes
Intel(R) Core(TM) i7-8550U CPU @ 1.80GHz [1.4321 us 1.4339 us 1.4357 us] [1.3385 ns 1.3456 ns 1.3552 ns] [228.77 us 232.17 us 236.23 us] [24.688 ns 25.083 ns 25.551 ns] [22.832 ns 22.910 ns 22.995 ns]
Intel(R) Core(TM) i7-8565U CPU @ 1.80GHz [1.3439 us 1.3499 us 1.3562 us] [1.5416 ns 1.5446 ns 1.5481 ns] [197.46 us 198.37 us 199.22 us] [20.455 ns 20.486 ns 20.518 ns] [18.726 ns 18.850 ns 18.993 ns]

Contributing

If you find a vulnerability, bug or would like a new feature, open a new issue.

To introduce your changes into the codebase, submit a Pull Request.

Many thanks!

License

Sharks is distributed under the terms of both the MIT license and the Apache License (Version 2.0).

See LICENSE-APACHE and LICENSE-MIT, and COPYRIGHT for details.

Dependencies

~0.7–1MB
~18K SLoC