[][src]Struct sssmc39::Share

pub struct Share {
    pub identifier: u16,
    pub iteration_exponent: u8,
    pub group_index: u8,
    pub group_threshold: u8,
    pub group_count: u8,
    pub member_index: u8,
    pub member_threshold: u8,
    pub share_value: Vec<u8>,
    pub checksum: u32,
    pub config: ShareConfig,
}

Main definition of a share and its mnemonic serialization

Fields

identifier: u16

Random 15 bit value which is the same for all shares and is used to verify that the shares belong together; it is also used as salt in the encryption of the master secret. (15 bits)

iteration_exponent: u8

Indicates the total number of iterations to be used in PBKDF2. The number of iterations is calculated as 10000x2^e. (5 bits)

group_index: u8

The x value of the group share (4 bits)

group_threshold: u8

indicates how many group shares are needed to reconstruct the master secret. The actual value is endoded as Gt = GT - 1, so a value of 0 indicates that a single group share is needed (GT = 1), a value of 1 indicates that two group shares are needed (GT = 2) etc. (4 bits)

group_count: u8

indicates the total number of groups. The actual value is encoded as g = G - 1 (4 bits)

member_index: u8

Member index, or x value of the member share in the given group (4 bits)

member_threshold: u8

indicates how many member shares are needed to reconstruct the group share. The actual value is encoded as t = T − 1. (4 bits)

share_value: Vec<u8>

corresponds to a list of the SSS part's fk(x) values 1 ≤ k ≤ n. Each fk(x) value is encoded as a string of eight bits in big-endian order. The concatenation of these bit strings is the share value. This value is left-padded with "0" bits so that the length of the padded share value in bits becomes the nearest multiple of 10. (padding + 8n bits)

checksum: u32

an RS1024 checksum of the data part of the share (that is id || e || GI || Gt || g || I || t || ps). The customization string (cs) of RS1024 is "shamir". (30 bits)

config: ShareConfig

configuration values

Implementations

impl Share[src]

pub fn new() -> Result<Share, Error>[src]

Create a new share with defaults

pub fn from_mnemonic(mn: &[String]) -> Result<Self, Error>[src]

convenience to create new from Mnemonic

pub fn from_u8_vec(input: &[u8]) -> Result<Self, Error>[src]

Convert from a u8 vec

pub fn to_mnemonic(&self) -> Result<Vec<String>, Error>[src]

Convert share data to a share mnemonic

pub fn to_u8_vec(&self) -> Result<Vec<u8>, Error>[src]

Convert share data to a share mnemonic (flattened string) Convert share data to u8 vec

Trait Implementations

impl Clone for Share[src]

impl Debug for Share[src]

impl Default for Share[src]

impl Eq for Share[src]

impl PartialEq<Share> for Share[src]

impl StructuralEq for Share[src]

impl StructuralPartialEq 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]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

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

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.