Struct sharks::Share[][src]

pub struct Share {
    pub x: GF256,
    pub y: Vec<GF256>,

A share used to reconstruct the secret. Can be serialized to and from a byte array.

Usage example:

use sharks::{Sharks, Share};
use core::convert::TryFrom;

// Transmit the share bytes to a printer
let sharks = Sharks(3);
let mut rng = rand_chacha::ChaCha8Rng::from_seed([0x90; 32]);
let dealer = sharks.dealer_rng(&[1, 2, 3], &mut rng);

// Get 5 shares and print paper keys
for s in dealer.take(5) {

// Get share bytes from an external source and recover secret
let shares_bytes: Vec<Vec<u8>> = ask_shares();
let shares: Vec<Share> = shares_bytes.iter().map(|s| Share::try_from(s.as_slice()).unwrap()).collect();
let secret = sharks.recover(&shares).unwrap();


x: GF256y: Vec<GF256>

Trait Implementations

impl Clone for Share[src]

impl Drop for Share[src]

impl TryFrom<&'_ [u8]> for Share[src]

Obtains a Share instance from a byte slice

type Error = &'static str

The type returned in the event of a conversion error.

impl Zeroize for Share[src]

Auto Trait Implementations

impl RefUnwindSafe for Share

impl Send for Share

impl Sync for Share

impl Unpin for Share

impl UnwindSafe for Share

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized

impl<T> Borrow<T> for T where
    T: ?Sized

impl<T> BorrowMut<T> for T where
    T: ?Sized

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 

impl<T> ToOwned for T where
    T: Clone

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,