Skip to main content

PairwiseAuthShare

Struct PairwiseAuthShare 

Source
pub struct PairwiseAuthShare<V, A, B> { /* private fields */ }
Expand description

Generic base for pairwise authenticated shares, analogous to PairwiseAuthKey.

The three type parameters are:

  • V: value type.
  • B: MAC and local key (Beta) type, an additive Group.
  • A: global key (Alpha) type.

The authenticated shares fulfill this relation:

MAC(x_i)_j = α_ji · x_i + β_ji ∀i∈[1..n] ∀j∈[1..n]∖{i}

where β_ji and α_ji are the (local and global) keys of value x_i held by P_j.

As such, the share of party P_i contains:

  • x_i, the unauthenticated share value (s.t. x = Σ x_i)
  • {MAC(x_i)_j} ∀j∈[1..n]∖{i}, the MACs of x_i for each of the other n-1 parties.
  • {β_ij} ∀j∈[1..n]∖{i} and {α_ij} ∀j∈[1..n]∖{i}, the (local and global) keys tied to the values&MACs of the other n-1 parties.

Implementations§

Source§

impl<V, A, B> PairwiseAuthShare<V, A, B>

Source

pub fn try_new( value: V, macs: Box<[B]>, keys: Box<[PairwiseAuthKey<A, B>]>, ) -> Result<Self, PrimitiveError>

Constructs a new share, returning an error if the MAC and key slices are inconsistent (empty or length-mismatched).

Source

pub fn get_value(&self) -> &V

Returns a reference to the share value.

Source

pub fn get_value_mut(&mut self) -> &mut V

Returns a mutable reference to the share value.

Source

pub fn get_macs(&self) -> &[B]

Returns a slice of all MACs (one per distant peer).

Source

pub fn get_mac(&self, peer_index: PeerIndex) -> Option<&B>

Returns the MAC for the given peer index, or None if out of bounds.

Source

pub fn get_keys(&self) -> &[PairwiseAuthKey<A, B>]

Returns a slice of all keys (one per distant peer).

Source

pub fn get_keys_mut(&mut self) -> &mut [PairwiseAuthKey<A, B>]

Returns a mutable slice of all keys.

Source

pub fn get_key(&self, peer_index: PeerIndex) -> Option<&PairwiseAuthKey<A, B>>

Returns the key for the given peer index, or None if out of bounds.

Source

pub fn into_value(self) -> V

Consumes the share, returning the value.

Source

pub fn into_inner(self) -> (V, Box<[B]>, Box<[PairwiseAuthKey<A, B>]>)

Consumes the share, returning all the internal data (value, MACs, and keys).

Source

pub fn n_parties(&self) -> usize

Total number of parties (including the local party).

Source

pub fn n_distant_parties(&self) -> usize

Number of distant parties (excludes the local party).

Source

pub fn get_alphas(&self) -> impl ExactSizeIterator<Item = GlobalKey<A>> + '_

Returns an iterator over the global keys (alpha values) for each distant peer.

Source

pub fn get_betas(&self) -> impl ExactSizeIterator<Item = &B> + '_

Returns an iterator over the local keys (beta values) for each distant peer.

Source§

impl<V, A, B> PairwiseAuthShare<V, A, B>

Source

pub fn compute_mac(value: V, key: &PairwiseAuthKey<A, B>) -> B
where A: Clone, B: for<'b> Add<&'b B, Output = B>, for<'a> V: Mul<&'a A, Output = B>,

Compute the MAC of a value x for ( α-global, β-local) keys as: MAC(x) = α * x + β

Source

pub fn verify_mac( key: &PairwiseAuthKey<A, B>, opening: PairwiseAuthOpenShare<V, B>, ) -> Choice
where A: Clone, B: ConstantTimeEq + SubAssign + for<'b> Add<&'b B, Output = B>, for<'a> V: Mul<&'a A, Output = B>,

Verify the MAC of a value x for ( α-global, β-local) keys fulfills: MAC(x) == α * x + β

Source§

impl<V: Copy, A: Clone, B: Copy, M: Positive> PairwiseAuthShare<HeapArray<V, M>, A, HeapArray<B, M>>

Source

pub fn split<M1, M2>( self, ) -> (BatchedShare<V, A, B, M1>, BatchedShare<V, A, B, M2>)
where M1: Positive, M2: Positive + Add<M1, Output = M>,

Splits a batched share of size M into two smaller batched shares (M1, M2), where M = M1 + M2.

Source

pub fn split_halves<MDiv2>( self, ) -> (BatchedShare<V, A, B, MDiv2>, BatchedShare<V, A, B, MDiv2>)
where MDiv2: Positive + Mul<U2, Output = M>,

Splits a batched share of size M into two smaller batched shares (M1, M2), where M = M1 + M2.

Source

pub fn merge_halves( this: Self, other: Self, ) -> BatchedShare<V, A, B, Prod<M, U2>>
where M: Mul<U2, Output: Positive>, A: PartialEq,

Merges two batched shares of sizes M/2 into a larger batched share of size M.

Source

pub fn split_thirds<MDiv3>( self, ) -> (BatchedShare<V, A, B, MDiv3>, BatchedShare<V, A, B, MDiv3>, BatchedShare<V, A, B, MDiv3>)
where MDiv3: Positive + Mul<U3, Output = M>,

Splits a batched share of size M into three smaller batched shares (M1, M2, M3), where M = M1 + M2 + M3.

Source

pub fn merge_thirds( first: Self, second: Self, third: Self, ) -> BatchedShare<V, A, B, Prod<M, U3>>
where M: Mul<U3, Output: Positive>, A: PartialEq,

Merges three batched shares of sizes M/3 into a larger batched share of size M.

Source

pub fn chunks<CS: Positive>( &self, ) -> BatchedSharesChunks<<HeapArray<V, M> as IntoIterator>::IntoIter, <HeapArray<B, M> as IntoIterator>::IntoIter, A, <HeapArray<B, M> as IntoIterator>::IntoIter, CS>
where M: PartialDiv<CS>,

Creates an iterator that yields fixed-size batched chunks of size CS.

Source

pub fn swap(&mut self, i: usize, j: usize)

Swaps elements at positions i and j in-place across value, macs, and key betas arrays.

Trait Implementations§

Source§

impl<'a, V, A, B> Add<&'a PairwiseAuthShare<V, A, B>> for &PairwiseAuthShare<V, A, B>
where for<'v> V: Add<&'v V, Output = V>, for<'b> B: Add<&'b B, Output = B>, for<'k> PairwiseAuthKey<A, B>: Add<&'k PairwiseAuthKey<A, B>, Output = PairwiseAuthKey<A, B>>, PairwiseAuthShare<V, A, B>: Clone,

Source§

type Output = PairwiseAuthShare<V, A, B>

The resulting type after applying the + operator.
Source§

fn add(self, rhs: &'a PairwiseAuthShare<V, A, B>) -> Self::Output

Performs the + operation. Read more
Source§

impl<'a, V, A, B> Add<&'a PairwiseAuthShare<V, A, B>> for PairwiseAuthShare<V, A, B>
where for<'v> V: Add<&'v V, Output = V>, for<'b> B: Add<&'b B, Output = B>, for<'k> PairwiseAuthKey<A, B>: Add<&'k PairwiseAuthKey<A, B>, Output = PairwiseAuthKey<A, B>>,

Source§

type Output = PairwiseAuthShare<V, A, B>

The resulting type after applying the + operator.
Source§

fn add(self, other: &'a PairwiseAuthShare<V, A, B>) -> Self::Output

Performs the + operation. Read more
Source§

impl<'a, V, A, B> Add<PairwiseAuthShare<V, A, B>> for &PairwiseAuthShare<V, A, B>
where for<'v> V: Add<&'v V, Output = V>, for<'b> B: Add<&'b B, Output = B>, for<'k> PairwiseAuthKey<A, B>: Add<&'k PairwiseAuthKey<A, B>, Output = PairwiseAuthKey<A, B>>,

Source§

type Output = PairwiseAuthShare<V, A, B>

The resulting type after applying the + operator.
Source§

fn add(self, rhs: PairwiseAuthShare<V, A, B>) -> Self::Output

Performs the + operation. Read more
Source§

impl<'a, V, A, B> Add for PairwiseAuthShare<V, A, B>
where for<'v> V: Add<&'v V, Output = V>, for<'b> B: Add<&'b B, Output = B>, for<'k> PairwiseAuthKey<A, B>: Add<&'k PairwiseAuthKey<A, B>, Output = PairwiseAuthKey<A, B>>,

Source§

type Output = PairwiseAuthShare<V, A, B>

The resulting type after applying the + operator.
Source§

fn add(self, rhs: PairwiseAuthShare<V, A, B>) -> Self::Output

Performs the + operation. Read more
Source§

impl<'a, V, A, B> AddAssign<&'a PairwiseAuthShare<V, A, B>> for PairwiseAuthShare<V, A, B>
where for<'v> V: AddAssign<&'v V>, for<'b> B: AddAssign<&'b B>, for<'k> PairwiseAuthKey<A, B>: AddAssign<&'k PairwiseAuthKey<A, B>>,

Source§

fn add_assign(&mut self, other: &'a PairwiseAuthShare<V, A, B>)

Performs the += operation. Read more
Source§

impl<'a, V, A, B> AddAssign for PairwiseAuthShare<V, A, B>
where for<'v> V: AddAssign<&'v V>, for<'b> B: AddAssign<&'b B>, for<'k> PairwiseAuthKey<A, B>: AddAssign<&'k PairwiseAuthKey<A, B>>,

Source§

fn add_assign(&mut self, rhs: PairwiseAuthShare<V, A, B>)

Performs the += operation. Read more
Source§

impl<V: Clone, A: Clone, B: Clone> Clone for PairwiseAuthShare<V, A, B>

Source§

fn clone(&self) -> PairwiseAuthShare<V, A, B>

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<V, A, B> ConditionallySelectable for PairwiseAuthShare<V, A, B>

Source§

fn conditional_select(a: &Self, b: &Self, choice: Choice) -> Self

Select a or b according to choice. Read more
Source§

impl<V, A, B> ConstantTimeEq for PairwiseAuthShare<V, A, B>

Source§

fn ct_eq(&self, other: &Self) -> Choice

Determine if two items are equal. Read more
Source§

fn ct_ne(&self, other: &Self) -> Choice

Determine if two items are NOT equal. Read more
Source§

impl<V: Debug, A: Debug, B: Debug> Debug for PairwiseAuthShare<V, A, B>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<V: Default, A: Default, B: Default> Default for PairwiseAuthShare<V, A, B>

Source§

fn default() -> PairwiseAuthShare<V, A, B>

Returns the “default value” for a type. Read more
Source§

impl<'de, V, A, B> Deserialize<'de> for PairwiseAuthShare<V, A, B>

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl<ItemV, A: Clone, ItemB, V, B, N: Positive> From<HeapArray<PairwiseAuthShare<ItemV, A, ItemB>, N>> for PairwiseAuthShare<V, A, B>
where V: FromIterator<ItemV>, B: FromIterator<ItemB>,

Source§

fn from(shares: HeapArray<PairwiseAuthShare<ItemV, A, ItemB>, N>) -> Self

Converts to this type from the input type.
Source§

impl<C: Curve, M: Positive> From<PairwiseAuthShare<HeapArray<SubfieldElement<<C as Curve>::Scalar>, M>, FieldElement<<C as Curve>::Scalar>, HeapArray<FieldElement<<C as Curve>::Scalar>, M>>> for PointShares<C, M>

Source§

fn from(scalar_shares: ScalarShares<C, M>) -> Self

Converts to this type from the input type.
Source§

impl<ItemV, A, ItemB> From<PairwiseAuthShare<ItemV, A, ItemB>> for BatchedShare<ItemV, A, ItemB, U1>

Source§

fn from(share: PairwiseAuthShare<ItemV, A, ItemB>) -> Self

Converts to this type from the input type.
Source§

impl<C: Curve> From<PairwiseAuthShare<SubfieldElement<<C as Curve>::Scalar>, FieldElement<<C as Curve>::Scalar>, FieldElement<<C as Curve>::Scalar>>> for PointShare<C>

Source§

fn from(scalar_share: ScalarShare<C>) -> Self

Converts to this type from the input type.
Source§

impl<ItemV, A: Clone, ItemB, V, B> FromIterator<PairwiseAuthShare<ItemV, A, ItemB>> for PairwiseAuthShare<V, A, B>
where V: FromIterator<ItemV>, B: FromIterator<ItemB>,

Source§

fn from_iter<T: IntoIterator<Item = PairwiseAuthShare<ItemV, A, ItemB>>>( iter: T, ) -> Self

Creates a value from an iterator. Read more
Source§

impl<V, A, B> IntoIterator for &PairwiseAuthShare<V, A, B>

Source§

type Item = PairwiseAuthShare<<V as IntoIterator>::Item, A, <B as IntoIterator>::Item>

The type of the elements being iterated over.
Source§

type IntoIter = BatchedSharesIterator<<V as IntoIterator>::IntoIter, <B as IntoIterator>::IntoIter, A, <B as IntoIterator>::IntoIter>

Which kind of iterator are we turning this into?
Source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more
Source§

impl<V, A, B> IntoIterator for PairwiseAuthShare<V, A, B>

Source§

type Item = PairwiseAuthShare<<V as IntoIterator>::Item, A, <B as IntoIterator>::Item>

The type of the elements being iterated over.
Source§

type IntoIter = BatchedSharesIterator<<V as IntoIterator>::IntoIter, <B as IntoIterator>::IntoIter, A, <B as IntoIterator>::IntoIter>

Which kind of iterator are we turning this into?
Source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more
Source§

impl<'a, V, V2, A, B, B2, Const> Mul<&'a Const> for &PairwiseAuthShare<V, A, B>
where for<'v> V: Mul<&'v Const, Output = V2>, for<'b> B: Mul<&'b Const, Output = B2>, PairwiseAuthShare<V, A, B>: Clone,

Source§

type Output = PairwiseAuthShare<V2, A, B2>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: &'a Const) -> Self::Output

Performs the * operation. Read more
Source§

impl<'a, V, V2, A, B, B2, Const> Mul<&'a Const> for PairwiseAuthShare<V, A, B>
where for<'v> V: Mul<&'v Const, Output = V2>, for<'b> B: Mul<&'b Const, Output = B2>,

Source§

type Output = PairwiseAuthShare<V2, A, B2>

The resulting type after applying the * operator.
Source§

fn mul(self, other: &'a Const) -> Self::Output

Performs the * operation. Read more
Source§

impl<'a, V, A, B, Const> MulAssign<&'a Const> for PairwiseAuthShare<V, A, B>
where for<'v> V: MulAssign<&'v Const>, for<'b> B: MulAssign<&'b Const>,

Source§

fn mul_assign(&mut self, other: &'a Const)

Performs the *= operation. Read more
Source§

impl<V, A, B> Neg for &PairwiseAuthShare<V, A, B>
where V: Neg<Output = V>, B: Neg<Output = B>, PairwiseAuthKey<A, B>: Neg<Output = PairwiseAuthKey<A, B>>, PairwiseAuthShare<V, A, B>: Clone,

Source§

type Output = PairwiseAuthShare<V, A, B>

The resulting type after applying the - operator.
Source§

fn neg(self) -> Self::Output

Performs the unary - operation. Read more
Source§

impl<V, A, B> Neg for PairwiseAuthShare<V, A, B>
where V: Neg<Output = V>, B: Neg<Output = B>, PairwiseAuthKey<A, B>: Neg<Output = PairwiseAuthKey<A, B>>,

Source§

type Output = PairwiseAuthShare<V, A, B>

The resulting type after applying the - operator.
Source§

fn neg(self) -> Self::Output

Performs the unary - operation. Read more
Source§

impl<V: PartialEq, A: PartialEq, B: PartialEq> PartialEq for PairwiseAuthShare<V, A, B>

Source§

fn eq(&self, other: &PairwiseAuthShare<V, A, B>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<V, A, B> PlaintextOps for PairwiseAuthShare<V, A, B>
where PairwiseAuthShare<V, A, B>: Reconstructible<Value = V>, for<'a> V: Clone + for<'a> AddAssign<&'a V> + for<'a> SubAssign<&'a V> + Mul<&'a A, Output = B>, A: Clone, B: Clone + for<'b> AddAssign<&'b B> + for<'b> SubAssign<&'b B> + ConstantTimeEq,

Source§

fn add_plaintext(self, ptx: &V, is_first_peer: bool) -> Self

If this is the first peer, adds the plaintext to the value; otherwise adjusts the first key’s beta: β₀ -= α₀ · ptx.

Source§

fn sub_plaintext(self, ptx: &V, is_first_peer: bool) -> Self

If this is the first peer, subtracts the plaintext from the value; otherwise adjusts the first key’s beta: β₀ += α₀ · ptx.

Source§

impl<V, A, B> Random for PairwiseAuthShare<V, A, B>
where for<'a> V: Random + Clone + Mul<&'a A, Output = B>, A: Random + Clone, B: Random + Clone + ConstantTimeEq + SubAssign + for<'b> Add<&'b B, Output = B>,

Source§

fn random_n<Container: FromIterator<Self>>( rng: impl CryptoRngCore, n_parties: usize, ) -> Container

Generate one random authenticated share per peer, with consistent MACs and keys across all peers.

Source§

fn random(_rng: impl CryptoRngCore) -> Self

Source§

fn random_array<M: Positive>(rng: impl CryptoRngCore) -> HeapArray<Self, M>

Source§

impl<V, A, B> RandomWith<(V, Vec<Arc<A>>)> for PairwiseAuthShare<V, A, B>
where for<'a> V: Clone + Mul<&'a A, Output = B>, A: Random + Clone, B: Random + Clone + ConstantTimeEq + SubAssign + for<'b> Add<&'b B, Output = B>,

Source§

fn random_with( rng: impl CryptoRngCore, (value, alphas): (V, Vec<GlobalKey<A>>), ) -> Self

Generate a random authenticated share with a given value whose keys are derived from alphas.

Source§

fn random_n_with_each<Container: FromIterator<Self>>( rng: impl CryptoRngCore, unauth_shares_and_alphas: impl IntoExactSizeIterator<Item = (V, Vec<GlobalKey<A>>)>, ) -> Container

Generate one authenticated share per peer from (value, alphas) pairs, computing MACs consistently across parties.

Source§

fn random_n_with<Container: FromIterator<Self>>( rng: impl CryptoRngCore, size: usize, data: D, ) -> Container

Source§

impl<V, A, B> RandomWith<(V, Vec<Vec<Arc<A>>>)> for PairwiseAuthShare<V, A, B>
where for<'a> V: AdditiveShares + Mul<&'a A, Output = B>, A: Random + Clone, B: Random + Clone + ConstantTimeEq + SubAssign + for<'b> Add<&'b B, Output = B>,

Source§

fn random_n_with<Container: FromIterator<Self>>( rng: impl CryptoRngCore, n_parties: usize, (secret_value, all_alphas): (V, Vec<Vec<GlobalKey<A>>>), ) -> Container

Secret share a value among n parties, each supplied with their own list of global keys.

Source§

fn random_with(_rng: impl CryptoRngCore, _: (V, Vec<Vec<GlobalKey<A>>>)) -> Self

Source§

fn random_n_with_each<Container: FromIterator<Self>>( rng: impl CryptoRngCore, all_data: impl IntoExactSizeIterator<Item = D>, ) -> Container

Source§

impl<V, A, B> RandomWith<(usize, V)> for PairwiseAuthShare<V, A, B>
where V: Clone, A: Random + Clone, B: Random,

Source§

fn random_with(rng: impl CryptoRngCore, (n_parties, value): (usize, V)) -> Self

Generate a random authenticated share with a given value and random MACs and keys.

Source§

fn random_n_with<Container: FromIterator<Self>>( rng: impl CryptoRngCore, size: usize, data: D, ) -> Container

Source§

fn random_n_with_each<Container: FromIterator<Self>>( rng: impl CryptoRngCore, all_data: impl IntoExactSizeIterator<Item = D>, ) -> Container

Source§

impl<V, A, B> RandomWith<V> for PairwiseAuthShare<V, A, B>
where for<'a> V: AdditiveShares + Mul<&'a A, Output = B>, A: Random + Clone, B: Random + Clone + ConstantTimeEq + SubAssign + for<'b> Add<&'b B, Output = B>,

Source§

fn random_n_with<Container: FromIterator<Self>>( rng: impl CryptoRngCore, n_parties: usize, value: V, ) -> Container

Secret share a value among n parties, generating an authenticated share for each peer with consistent MACs and keys across all peers.

Source§

fn random_n_with_each<Container: FromIterator<Self>>( rng: impl CryptoRngCore, unauth_shares: impl IntoExactSizeIterator<Item = V>, ) -> Container

Generate an authenticated share for each peer given its additive share value, with consistent MACs and keys across all peers.

Source§

fn random_with(_rng: impl CryptoRngCore, _data: V) -> Self

Source§

impl<V, A, B> RandomWith<Vec<Arc<A>>> for PairwiseAuthShare<V, A, B>
where for<'a> V: Random + Clone + Mul<&'a A, Output = B>, A: Random + Clone, B: Random + Clone + ConstantTimeEq + SubAssign + for<'b> Add<&'b B, Output = B>,

Source§

fn random_with(rng: impl CryptoRngCore, alphas: Vec<GlobalKey<A>>) -> Self

Generate a random authenticated share whose keys are derived from the given global keys.

Source§

fn random_n_with_each<Container: FromIterator<Self>>( rng: impl CryptoRngCore, all_alphas: impl IntoExactSizeIterator<Item = Vec<GlobalKey<A>>>, ) -> Container

Generate one authenticated share per peer, deriving each party’s keys from their global keys.

Source§

fn random_n_with<Container: FromIterator<Self>>( rng: impl CryptoRngCore, size: usize, data: D, ) -> Container

Source§

impl<V, A, B> RandomWith<usize> for PairwiseAuthShare<V, A, B>
where V: Random, A: Random + Clone, B: Random,

Source§

fn random_with(rng: impl CryptoRngCore, n_parties: usize) -> Self

Generate a random authenticated share with random MACs and keys for all other parties.

Source§

fn random_n_with<Container: FromIterator<Self>>( rng: impl CryptoRngCore, size: usize, data: D, ) -> Container

Source§

fn random_n_with_each<Container: FromIterator<Self>>( rng: impl CryptoRngCore, all_data: impl IntoExactSizeIterator<Item = D>, ) -> Container

Source§

impl<V, A, B> Reconstructible for PairwiseAuthShare<V, A, B>
where for<'a, 'a> V: Clone + PartialEq + Send + Sync + 'static + Serialize + DeserializeOwned + SchemaWrite<Src = V> + for<'de> SchemaRead<'de, Dst = V> + Add<&'a V, Output = V> + Mul<&'a A, Output = B>, A: Clone, B: Clone + Send + Sync + 'static + Serialize + DeserializeOwned + SchemaWrite<Src = B> + for<'de> SchemaRead<'de, Dst = B> + ConstantTimeEq + SubAssign + for<'b> Add<&'b B, Output = B>,

Source§

fn open_to( &self, peer: PeerIndex, ) -> Result<PairwiseAuthOpenShare<V, B>, PrimitiveError>

Open the share towards another peer.

Source§

fn open_to_all_others( &self, ) -> impl ExactSizeIterator<Item = PairwiseAuthOpenShare<V, B>>

Open the share towards all other peers.

Source§

fn reconstruct( &self, openings: Vec<PairwiseAuthOpenShare<V, B>>, ) -> Result<V, PrimitiveError>

Reconstruct a secret from openings coming from all other parties.

Source§

type Opening = PairwiseAuthOpenShare<V, B>

The type that is sent to / received from other peers.
Source§

type Value = V

The type of the reconstructed value.
Source§

fn reconstruct_all<T: Borrow<Self>>( shares: Vec<T>, ) -> Result<Self::Value, PrimitiveError>

Reconstruct a secret from a collection of shares, by opening each share towards all other peers, reconstructing n secrets from the openings and checking that they are all equal.
Source§

impl<'de, V, A, B> SchemaRead<'de> for PairwiseAuthShare<V, A, B>
where V: SchemaRead<'de, Dst = V>, B: SchemaRead<'de, Dst = B>, PairwiseAuthKey<A, B>: SchemaRead<'de, Dst = PairwiseAuthKey<A, B>>,

Source§

type Dst = PairwiseAuthShare<V, A, B>

Source§

fn read( reader: &mut impl Reader<'de>, dst: &mut MaybeUninit<Self>, ) -> ReadResult<()>

Read into dst from reader. Read more
Source§

const TYPE_META: TypeMeta = TypeMeta::Dynamic

Source§

fn get(reader: &mut impl Reader<'de>) -> Result<Self::Dst, ReadError>

Read Self::Dst from reader into a new Self::Dst.
Source§

impl<V, A, B> SchemaWrite for PairwiseAuthShare<V, A, B>
where V: SchemaWrite<Src = V>, B: SchemaWrite<Src = B>, PairwiseAuthKey<A, B>: SchemaWrite<Src = PairwiseAuthKey<A, B>>,

Source§

type Src = PairwiseAuthShare<V, A, B>

Source§

fn size_of(src: &Self) -> WriteResult<usize>

Get the serialized size of Self::Src.
Source§

fn write(writer: &mut impl Writer, src: &Self) -> WriteResult<()>

Write Self::Src to writer.
Source§

const TYPE_META: TypeMeta = TypeMeta::Dynamic

Source§

impl<V, A, B> Serialize for PairwiseAuthShare<V, A, B>

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl<'a, V, A, B> Sub<&'a PairwiseAuthShare<V, A, B>> for &PairwiseAuthShare<V, A, B>
where for<'v> V: Sub<&'v V, Output = V>, for<'b> B: Sub<&'b B, Output = B>, for<'k> PairwiseAuthKey<A, B>: Sub<&'k PairwiseAuthKey<A, B>, Output = PairwiseAuthKey<A, B>>, PairwiseAuthShare<V, A, B>: Clone,

Source§

type Output = PairwiseAuthShare<V, A, B>

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: &'a PairwiseAuthShare<V, A, B>) -> Self::Output

Performs the - operation. Read more
Source§

impl<'a, V, A, B> Sub<&'a PairwiseAuthShare<V, A, B>> for PairwiseAuthShare<V, A, B>
where for<'v> V: Sub<&'v V, Output = V>, for<'b> B: Sub<&'b B, Output = B>, for<'k> PairwiseAuthKey<A, B>: Sub<&'k PairwiseAuthKey<A, B>, Output = PairwiseAuthKey<A, B>>,

Source§

type Output = PairwiseAuthShare<V, A, B>

The resulting type after applying the - operator.
Source§

fn sub(self, other: &'a PairwiseAuthShare<V, A, B>) -> Self::Output

Performs the - operation. Read more
Source§

impl<'a, V, A, B> Sub<PairwiseAuthShare<V, A, B>> for &PairwiseAuthShare<V, A, B>
where for<'v> V: Sub<&'v V, Output = V>, for<'b> B: Sub<&'b B, Output = B>, for<'k> PairwiseAuthKey<A, B>: Sub<&'k PairwiseAuthKey<A, B>, Output = PairwiseAuthKey<A, B>>, PairwiseAuthShare<V, A, B>: Clone,

Source§

type Output = PairwiseAuthShare<V, A, B>

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: PairwiseAuthShare<V, A, B>) -> Self::Output

Performs the - operation. Read more
Source§

impl<'a, V, A, B> Sub for PairwiseAuthShare<V, A, B>
where for<'v> V: Sub<&'v V, Output = V>, for<'b> B: Sub<&'b B, Output = B>, for<'k> PairwiseAuthKey<A, B>: Sub<&'k PairwiseAuthKey<A, B>, Output = PairwiseAuthKey<A, B>>,

Source§

type Output = PairwiseAuthShare<V, A, B>

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: PairwiseAuthShare<V, A, B>) -> Self::Output

Performs the - operation. Read more
Source§

impl<'a, V, A, B> SubAssign<&'a PairwiseAuthShare<V, A, B>> for PairwiseAuthShare<V, A, B>
where for<'v> V: SubAssign<&'v V>, for<'b> B: SubAssign<&'b B>, for<'k> PairwiseAuthKey<A, B>: SubAssign<&'k PairwiseAuthKey<A, B>>,

Source§

fn sub_assign(&mut self, other: &'a PairwiseAuthShare<V, A, B>)

Performs the -= operation. Read more
Source§

impl<'a, V, A, B> SubAssign for PairwiseAuthShare<V, A, B>
where for<'v> V: SubAssign<&'v V>, for<'b> B: SubAssign<&'b B>, for<'k> PairwiseAuthKey<A, B>: SubAssign<&'k PairwiseAuthKey<A, B>>,

Source§

fn sub_assign(&mut self, rhs: PairwiseAuthShare<V, A, B>)

Performs the -= operation. Read more
Source§

impl<'a, V, A, B> Sum<&'a PairwiseAuthShare<V, A, B>> for PairwiseAuthShare<V, A, B>
where PairwiseAuthShare<V, A, B>: Clone + Default + AddAssign<&'a PairwiseAuthShare<V, A, B>>,

Source§

fn sum<I: Iterator<Item = &'a PairwiseAuthShare<V, A, B>>>(iter: I) -> Self

Takes an iterator and generates Self from the elements by “summing up” the items.
Source§

impl<V, A, B> Sum for PairwiseAuthShare<V, A, B>
where for<'v> V: AddAssign<&'v V>, for<'b> B: AddAssign<&'b B>, for<'k> PairwiseAuthKey<A, B>: AddAssign<&'k PairwiseAuthKey<A, B>>, PairwiseAuthShare<V, A, B>: Default,

Source§

fn sum<I: Iterator<Item = Self>>(iter: I) -> Self

Takes an iterator and generates Self from the elements by “summing up” the items.
Source§

impl<V, A, B> VerifiableWith for PairwiseAuthShare<V, A, B>
where for<'a, 'a> V: Clone + PartialEq + Send + Sync + 'static + Serialize + DeserializeOwned + SchemaWrite<Src = V> + for<'de> SchemaRead<'de, Dst = V> + Add<&'a V, Output = V> + Mul<&'a A, Output = B>, A: Clone, B: Clone + Send + Sync + 'static + Serialize + DeserializeOwned + SchemaWrite<Src = B> + for<'de> SchemaRead<'de, Dst = B> + ConstantTimeEq + SubAssign + for<'b> Add<&'b B, Output = B>,

Source§

fn verify_from_peer_with( &self, open_share: PairwiseAuthOpenShare<V, B>, peer: PeerIndex, _verification_data: (), ) -> Result<(), PrimitiveError>

Check the MACs of the share received from another peer.

Source§

fn verify_with( &self, open_shares: Vec<PairwiseAuthOpenShare<V, B>>, _verification_data: (), ) -> Result<(), PrimitiveError>

Check the MACs of each share received from all other peers.

Source§

type VerificationData = ()

The associated data that is used to verify this secret shared type.
Source§

fn verify_all_with( shares: Vec<Self>, verification_data: Self::VerificationData, ) -> Result<(), PrimitiveError>

Verify all shares by opening each share towards all other peers and performing pairwise verification of the openings.
Source§

impl<V: Eq, A: Eq, B: Eq> Eq for PairwiseAuthShare<V, A, B>

Source§

impl<V, A, B> StructuralPartialEq for PairwiseAuthShare<V, A, B>

Auto Trait Implementations§

§

impl<V, A, B> Freeze for PairwiseAuthShare<V, A, B>
where V: Freeze,

§

impl<V, A, B> RefUnwindSafe for PairwiseAuthShare<V, A, B>

§

impl<V, A, B> Send for PairwiseAuthShare<V, A, B>
where V: Send, B: Send, A: Sync + Send,

§

impl<V, A, B> Sync for PairwiseAuthShare<V, A, B>
where V: Sync, B: Sync, A: Sync + Send,

§

impl<V, A, B> Unpin for PairwiseAuthShare<V, A, B>
where V: Unpin,

§

impl<V, A, B> UnsafeUnpin for PairwiseAuthShare<V, A, B>
where V: UnsafeUnpin,

§

impl<V, A, B> UnwindSafe for PairwiseAuthShare<V, A, B>

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<'a, T, E> AsTaggedExplicit<'a, E> for T
where T: 'a,

Source§

fn explicit(self, class: Class, tag: u32) -> TaggedParser<'a, Explicit, Self, E>

Source§

impl<'a, T, E> AsTaggedImplicit<'a, E> for T
where T: 'a,

Source§

fn implicit( self, class: Class, constructed: bool, tag: u32, ) -> TaggedParser<'a, Implicit, Self, E>

Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> Conv for T

Source§

fn conv<T>(self) -> T
where Self: Into<T>,

Converts self into T using Into<T>. Read more
Source§

impl<'de, T> Deserialize<'de> for T
where T: SchemaRead<'de>,

Source§

fn deserialize(src: &'de [u8]) -> Result<Self::Dst, ReadError>

Deserialize bytes into a new Self::Dst.
Source§

fn deserialize_into( src: &'de [u8], dst: &mut MaybeUninit<Self::Dst>, ) -> Result<(), ReadError>

Deserialize bytes into target.
Source§

impl<T> DeserializeOwned for T
where T: SchemaReadOwned,

Source§

fn deserialize_from<'de>( src: &mut impl Reader<'de>, ) -> Result<Self::Dst, ReadError>

Deserialize from the given Reader into a new Self::Dst.
Source§

fn deserialize_from_into<'de>( src: &mut impl Reader<'de>, dst: &mut MaybeUninit<Self::Dst>, ) -> Result<(), ReadError>

Deserialize from the given Reader into dst.
Source§

impl<T> FmtForward for T

Source§

fn fmt_binary(self) -> FmtBinary<Self>
where Self: Binary,

Causes self to use its Binary implementation when Debug-formatted.
Source§

fn fmt_display(self) -> FmtDisplay<Self>
where Self: Display,

Causes self to use its Display implementation when Debug-formatted.
Source§

fn fmt_lower_exp(self) -> FmtLowerExp<Self>
where Self: LowerExp,

Causes self to use its LowerExp implementation when Debug-formatted.
Source§

fn fmt_lower_hex(self) -> FmtLowerHex<Self>
where Self: LowerHex,

Causes self to use its LowerHex implementation when Debug-formatted.
Source§

fn fmt_octal(self) -> FmtOctal<Self>
where Self: Octal,

Causes self to use its Octal implementation when Debug-formatted.
Source§

fn fmt_pointer(self) -> FmtPointer<Self>
where Self: Pointer,

Causes self to use its Pointer implementation when Debug-formatted.
Source§

fn fmt_upper_exp(self) -> FmtUpperExp<Self>
where Self: UpperExp,

Causes self to use its UpperExp implementation when Debug-formatted.
Source§

fn fmt_upper_hex(self) -> FmtUpperHex<Self>
where Self: UpperHex,

Causes self to use its UpperHex implementation when Debug-formatted.
Source§

fn fmt_list(self) -> FmtList<Self>
where &'a Self: for<'a> IntoIterator,

Formats each item in a sequence. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

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

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Pipe for T
where T: ?Sized,

Source§

fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> R
where Self: Sized,

Pipes by value. This is generally the method you want to use. Read more
Source§

fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> R
where R: 'a,

Borrows self and passes that borrow into the pipe function. Read more
Source§

fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> R
where R: 'a,

Mutably borrows self and passes that borrow into the pipe function. Read more
Source§

fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
where Self: Borrow<B>, B: 'a + ?Sized, R: 'a,

Borrows self, then passes self.borrow() into the pipe function. Read more
Source§

fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
where Self: BorrowMut<B>, B: 'a + ?Sized, R: 'a,

Mutably borrows self, then passes self.borrow_mut() into the pipe function. Read more
Source§

fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
where Self: AsRef<U>, U: 'a + ?Sized, R: 'a,

Borrows self, then passes self.as_ref() into the pipe function.
Source§

fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
where Self: AsMut<U>, U: 'a + ?Sized, R: 'a,

Mutably borrows self, then passes self.as_mut() into the pipe function.
Source§

fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
where Self: Deref<Target = T>, T: 'a + ?Sized, R: 'a,

Borrows self, then passes self.deref() into the pipe function.
Source§

fn pipe_deref_mut<'a, T, R>( &'a mut self, func: impl FnOnce(&'a mut T) -> R, ) -> R
where Self: DerefMut<Target = T> + Deref, T: 'a + ?Sized, R: 'a,

Mutably borrows self, then passes self.deref_mut() into the pipe function.
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> Serialize for T
where T: SchemaWrite + ?Sized,

Source§

fn serialize(src: &Self::Src) -> Result<Vec<u8>, WriteError>

Serialize a serializable type into a Vec of bytes.
Source§

fn serialize_into( dst: &mut impl Writer, src: &Self::Src, ) -> Result<(), WriteError>

Serialize a serializable type into the given byte buffer.
Source§

fn serialized_size(src: &Self::Src) -> Result<u64, WriteError>

Get the size in bytes of the type when serialized.
Source§

impl<T> Tap for T

Source§

fn tap(self, func: impl FnOnce(&Self)) -> Self

Immutable access to a value. Read more
Source§

fn tap_mut(self, func: impl FnOnce(&mut Self)) -> Self

Mutable access to a value. Read more
Source§

fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
where Self: Borrow<B>, B: ?Sized,

Immutable access to the Borrow<B> of a value. Read more
Source§

fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
where Self: BorrowMut<B>, B: ?Sized,

Mutable access to the BorrowMut<B> of a value. Read more
Source§

fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
where Self: AsRef<R>, R: ?Sized,

Immutable access to the AsRef<R> view of a value. Read more
Source§

fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
where Self: AsMut<R>, R: ?Sized,

Mutable access to the AsMut<R> view of a value. Read more
Source§

fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
where Self: Deref<Target = T>, T: ?Sized,

Immutable access to the Deref::Target of a value. Read more
Source§

fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
where Self: DerefMut<Target = T> + Deref, T: ?Sized,

Mutable access to the Deref::Target of a value. Read more
Source§

fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self

Calls .tap() only in debug builds, and is erased in release builds.
Source§

fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self

Calls .tap_mut() only in debug builds, and is erased in release builds.
Source§

fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
where Self: Borrow<B>, B: ?Sized,

Calls .tap_borrow() only in debug builds, and is erased in release builds.
Source§

fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
where Self: BorrowMut<B>, B: ?Sized,

Calls .tap_borrow_mut() only in debug builds, and is erased in release builds.
Source§

fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
where Self: AsRef<R>, R: ?Sized,

Calls .tap_ref() only in debug builds, and is erased in release builds.
Source§

fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
where Self: AsMut<R>, R: ?Sized,

Calls .tap_ref_mut() only in debug builds, and is erased in release builds.
Source§

fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
where Self: Deref<Target = T>, T: ?Sized,

Calls .tap_deref() only in debug builds, and is erased in release builds.
Source§

fn tap_deref_mut_dbg<T>(self, func: impl FnOnce(&mut T)) -> Self
where Self: DerefMut<Target = T> + Deref, T: ?Sized,

Calls .tap_deref_mut() only in debug builds, and is erased in release builds.
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> TryConv for T

Source§

fn try_conv<T>(self) -> Result<T, Self::Error>
where Self: TryInto<T>,

Attempts to convert self into T using TryInto<T>. Read more
Source§

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

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

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

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

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

Source§

fn vzip(self) -> V

Source§

impl<T> Verifiable for T
where T: VerifiableWith<VerificationData = ()>,

Source§

fn verify( &self, openings: Vec<<T as Reconstructible>::Opening>, ) -> Result<(), PrimitiveError>

Verify openings from all peers.
Source§

fn verify_from( &self, opening: <T as Reconstructible>::Opening, peer_index: usize, ) -> Result<(), PrimitiveError>

Verify an opening from a specific peer.
Source§

fn verify_all(shares: Vec<T>) -> Result<(), PrimitiveError>

Verify all shares by opening each share towards all other peers and performing pairwise verification of the openings.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T, Rhs, Output> GroupOps<Rhs, Output> for T
where T: Add<Rhs, Output = Output> + Sub<Rhs, Output = Output> + AddAssign<Rhs> + SubAssign<Rhs>,

Source§

impl<T, Rhs, Output> GroupOpsOwned<Rhs, Output> for T
where T: for<'r> GroupOps<&'r Rhs, Output>,

Source§

impl<T, S> IntoExactSizeIterator for T
where T: IntoIterator<IntoIter = S>, S: ExactSizeIterator<Item = <T as IntoIterator>::Item>,

Source§

impl<T, Rhs, Output> ScalarMul<Rhs, Output> for T
where T: Mul<Rhs, Output = Output> + MulAssign<Rhs>,

Source§

impl<T, Rhs, Output> ScalarMulOwned<Rhs, Output> for T
where T: for<'r> ScalarMul<&'r Rhs, Output>,

Source§

impl<T> SchemaReadOwned for T
where T: for<'de> SchemaRead<'de>,