#shamir-secret-sharing #secret-sharing #pure

shamir

Shamir is a pure Rust implementation of Shamir's secret sharing

4 stable releases

Uses old Rust 2015

2.0.0 Jan 21, 2020
1.0.2 Jan 24, 2016

#2102 in Cryptography

Download history 53/week @ 2024-07-22 65/week @ 2024-07-29 48/week @ 2024-08-05 34/week @ 2024-08-12 36/week @ 2024-08-19 43/week @ 2024-08-26 65/week @ 2024-09-02 129/week @ 2024-09-09 70/week @ 2024-09-16 81/week @ 2024-09-23 68/week @ 2024-09-30 48/week @ 2024-10-07 109/week @ 2024-10-14 86/week @ 2024-10-21 64/week @ 2024-10-28 62/week @ 2024-11-04

325 downloads per month

MIT license

16KB
303 lines

Shamir

Coverage Status

Build Status

Shamir is a pure Rust implementation of Shamir's secret sharing.

Install

To install shamir into your application, you need to add it to your cargo.toml:

[dependencies]
shamir = "~1.0"

and you need to include it at the top of oyur main.rs:

extern crate shamir;

use shamir::SecretData;

Usage

extern crate shamir;

use shamir::SecretData;

fn main() {
    let secret_data = SecretData::with_secret("Hello World!", 3);

    let share1 = secret_data.get_share(1);
    let share2 = secret_data.get_share(2);
    let share3 = secret_data.get_share(3);

    let recovered = SecretData::recover_secret(3, vec![share1, share2, share3]).unwrap();

    println!("Recovered {}", recovered);
}

Dependencies

~1.4–2MB
~37K SLoC