4 releases
0.1.3 | Nov 26, 2024 |
---|---|
0.1.2 | Nov 25, 2024 |
0.1.1 | Nov 23, 2024 |
0.1.0 | Nov 23, 2024 |
#19 in #shamir-secret-sharing
466 downloads per month
70KB
1K
SLoC
Experimental Shamir's secret sharing algorithm implementation in Rust programming language.
Disclaimer
This is experimental implementation of Shamir Secret Sharing algorithm. This crate uses cryptographically safe libraries and dependencies and authors payed attention to make it secure. But it is not extensively tested for cybersecurity usage and it is recommended to not use this crate in cybersecurity projects or cryptographically secured applications. The subject of this crate is purely experimental.
The theory:
Shamir's secret sharing (SSS) is an efficient secret sharing algorithm for distributing private information (the "secret") among a group. The secret cannot be revealed unless a quorum of the group acts together to pool their knowledge.
Technology
This algorithm is implemented in Rust 2021 edition.
Dependencies
- Random number generator is using vendored Openssl library v111.
- Bignum calculations are using BigNum from vendored Openssl library v111.
- Base64 encoding uses base64 crate.
- Hex encoding uses hex crate.
- Errors are in format of Thiserror crate.
- Default prime number used for mod operations is: 115792089237316195423570985008687907853269984665640564039457584007913129639747
Usage:
Unit tests
To run unit test run in terminal:
cargo t --release -- --test-threads=1
Benchmarks
To run benchmarks of library exposed functions run in terminal:
cargo bench
Macbook M2 (ARM64) processor:
- To create 100 shares with 50 minimum shares threshold of 512 bytes long key takes 25 [ ms ].
- To recreate 512 bytes long key from 100 shares with min 50 shares threshold takes 140 [ ms ].
Documentation
Dependencies
~2.3–6.5MB
~149K SLoC