Struct sharks::Share [−][src]
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) { send_to_printer(Vec::from(&s)); }; // 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();
Fields
x: GF256
y: 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.
fn try_from(s: &[u8]) -> Result<Share, Self::Error>
[src]
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,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,