sss-rs

Build Status

An implementation of a secret sharing scheme in Rust. This is not meant to be a serious/optimized implementation, it's more of a fun project to further my Rust knowledge.

Some things to note:

New Example with the current API

``` let dir = "./"; let stem = "test"; let numshares = 3; let secret: Vec = vec![5, 4, 9, 1, 2, 128, 43]; let sharer = Sharer::builder(secret) .sharesrequired(numshares) // Default is 3 if not explicitly set .sharestocreate(numshares)// Default is 3 if not explicitly set .build() .unwrap(); sharer.sharetofiles(dir, stem).unwrap(); let recon = Sharer::reconstructor(dir, stem, numshares).unwrap(); asserteq!(secret, *recon_secret);

```

Old Example (makes use of raw_share functions)

``` let mut rand = SmallRng::seedfromu64(123u64); let secret: u8 = 23; // The secret to be split into shares let sharesrequired = 3; // The number of shares required to reconstruct the secret let sharestocreate = 3; // The number of shares to create, can be greater than the required let bitsizeco: usize = rand.genrange(32, 65); // The number of bits for the generated coefficients

let shares: Vec<(u8, u8)> = createsharesfromsecret( secret, sharesrequired, sharestocreate).unwrap(); let secretrecon = reconstructsecret(shares);

asserteq!(secret, secretrecon); ```

TODO:

- The shuffle operation was left out of the new API, mainly because it would not function after the 
  above change is implemented. May re-implement a way to shuffle the data in-file. For now this 
  will be benched.