Crates.io | shamir_file_secret_sharing |
lib.rs | shamir_file_secret_sharing |
version | 1.0.0 |
source | src |
created_at | 2022-12-02 20:37:20.005847 |
updated_at | 2022-12-02 20:37:20.005847 |
description | Implementation of Shamir secret sharing for use with files |
homepage | |
repository | https://github.com/salsifis/shamir_secret_sharing |
max_upload_size | |
id | 728612 |
size | 82,117 |
(C) 2022 BenoƮt Mortgat
shamir_secret_sharing - Rust implementation of Shamir secret sharing for use with files.
This program has been tested on GNU/Linux and Windows.
Creation of Shamir secret shares:
shamir_secret_sharing share <secret_file> <share_count>
Where:
* <secret_file> : sensitive file to be converted into Shamir shares
* <share_count> : number of shares to create (2 to 255)
*
Recovery of secret from shares:
shamir_secret_sharing recover <recovered_file>
You need a nightly rust toolchain to build. This crate makes heavy use of constant lookup tables that are built at compile time.
In order to use on this file (example command-lines using a bash shell):
This example will make 5 shares with a threshold of 3 shares for recovery.
$ cargo +nightly build --release
$ cargo +nightly run --release -- share README.txt 5 3
$ cargo +nightly run --release -- recover README.txt{.out,_001,_004,_005}
$ diff README.txt{,.out}
You can use:
$ cargo +nightly install
--git https://github.com/salsifis/shamir_secret_sharing
--branch main
shamir_secret_sharing
Q. What is the share file format? A. The file format consists of:
Q. What are the mathematical objects used here? A. The Galois field used is GF(256) using x^8 + x^7 + x^6 + x^3 + x^2 + x + 1 as the irreductible polynomial for multiplication purposes. A list of suitable irreductible polynomials can be found in the source code.
Q. Any security weaknesses? A. - Operations in the Galois field use lookup tables. As a consequence, they may be not run in constant time. When generating secret shares, be sure to run this program in a controlled environment that cannot be subject to timing attacks.
The source passes cargo clippy, and is auto-formatted with cargo fmt.
The sources include: