Skip to content

pawanjay176/secretsharing

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Shamir's secret sharing

Rust port of Shamir's secret sharing from https://github.com/blockstack/secret-sharing. Distribute arbitary secrets among multiple parties.

Usage

Run example with

cargo run --example ss_example

extern crate secretsharing;

use secretsharing::ss::{Charset, SecretSharing};

fn main() {
    let threshold = 3;
    let total_shares = 5;
    let secret = "HelloWorld123";
    let mut ss = SecretSharing::new(
        threshold,             // Minimum shares required for reconstruction.
        total_shares,          // Total shares.
        Charset::Alphanumeric, // Charset of secret.
    );
    let shares = ss.generate_shares(secret).unwrap();
    let reconstructed_secret = ss.reconstruct_secret(&shares[0..3].to_vec()).unwrap();
    assert_eq!(reconstructed_secret, secret);
}

About

Rust implementation of Shamir's secret sharing

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages