pub struct FieldShare<F>where
F: FieldExtension,{ /* private fields */ }Expand description
Authenticated share <x_i> of secret shared P_i (this party).
They are composed of:
x_i, the unauthenticated share value (s.t.x = Σ x_i){MAC(x_i)_j} ∀j∈[1..n]∖{i}, the MACs ofx_ifor 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.
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 x_i held by P_j.
Implementations§
pub fn try_new( value: SubfieldElement<F>, macs: Box<[FieldElement<F>]>, keys: Box<[FieldShareKey<F>]>, ) -> Result<Self, PrimitiveError>
pub fn zero_from_alphas( alphas: impl ExactSizeIterator<Item = GlobalFieldKey<F>>, ) -> Self
pub fn get_value(&self) -> &SubfieldElement<F>
pub fn value(self) -> SubfieldElement<F>
pub fn get_macs(&self) -> &[FieldElement<F>]
pub fn get_mac(&self, peer_index: PeerIndex) -> Option<&FieldElement<F>>
pub fn get_keys(&self) -> &[FieldShareKey<F>]
pub fn get_key(&self, peer_index: PeerIndex) -> Option<&FieldShareKey<F>>
pub fn get_alphas( &self, ) -> impl ExactSizeIterator<Item = GlobalFieldKey<F>> + '_
pub fn n_parties(&self) -> usize
Trait Implementations§
Source§type Output = FieldShare<F>
type Output = FieldShare<F>
+ operator.Source§type Output = FieldShare<F>
type Output = FieldShare<F>
+ operator.Source§type Output = FieldShare<F>
type Output = FieldShare<F>
+ operator.Source§type Output = FieldShare<F>
type Output = FieldShare<F>
+ operator.Source§fn add_assign(&mut self, other: &'a FieldShare<F>)
fn add_assign(&mut self, other: &'a FieldShare<F>)
+= operation. Read moreSource§fn add_assign(&mut self, rhs: FieldShare<F>)
fn add_assign(&mut self, rhs: FieldShare<F>)
+= operation. Read moreSource§fn add_plaintext(
&self,
plaintext: &SubfieldElement<F>,
is_peer_zero: IsFirstPeer,
) -> Self
fn add_plaintext( &self, plaintext: &SubfieldElement<F>, is_peer_zero: IsFirstPeer, ) -> Self
Adds a plaintext to the secret shared value, updating the keys accordingly. A designated peer (P_0) will modify its value, while the other peers will update their keys.
Source§fn add_plaintext_owned(
self,
plaintext: &SubfieldElement<F>,
is_peer_zero: IsFirstPeer,
) -> Self
fn add_plaintext_owned( self, plaintext: &SubfieldElement<F>, is_peer_zero: IsFirstPeer, ) -> Self
Adds a plaintext to the secret shared value, updating the keys accordingly. A designated peer (P_0) will modify its value, while the other peers will update their keys.
type AssociatedInformation = bool
Source§fn clone(&self) -> FieldShare<F>
fn clone(&self) -> FieldShare<F>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§fn conditional_select(a: &Self, b: &Self, choice: Choice) -> Self
fn conditional_select(a: &Self, b: &Self, choice: Choice) -> Self
Source§fn default() -> FieldShare<F>
fn default() -> FieldShare<F>
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§fn from(share: FieldShare<F>) -> Self
fn from(share: FieldShare<F>) -> Self
Source§fn from_iter<T: IntoIterator<Item = FieldShare<F>>>(iter: T) -> Self
fn from_iter<T: IntoIterator<Item = FieldShare<F>>>(iter: T) -> Self
Source§type Output = PointShare<C>
type Output = PointShare<C>
* operator.Source§type Output = PointShare<C>
type Output = PointShare<C>
* operator.Source§fn mul(self, other: &'a ScalarShare<C>) -> PointShare<C>
fn mul(self, other: &'a ScalarShare<C>) -> PointShare<C>
* operation. Read moreSource§type Output = FieldShare<F>
type Output = FieldShare<F>
* operator.Source§type Output = FieldShare<F>
type Output = FieldShare<F>
* operator.Source§fn mul(self, other: &'a SubfieldElement<F>) -> FieldShare<F>
fn mul(self, other: &'a SubfieldElement<F>) -> FieldShare<F>
* operation. Read moreSource§type Output = PointShare<C>
type Output = PointShare<C>
* operator.Source§type Output = PointShare<C>
type Output = PointShare<C>
* operator.Source§type Output = FieldShare<F>
type Output = FieldShare<F>
* operator.Source§type Output = FieldShare<F>
type Output = FieldShare<F>
* operator.Source§fn mul_assign(&mut self, other: &'a SubfieldElement<F>)
fn mul_assign(&mut self, other: &'a SubfieldElement<F>)
*= operation. Read moreSource§fn mul_assign(&mut self, rhs: SubfieldElement<F>)
fn mul_assign(&mut self, rhs: SubfieldElement<F>)
*= operation. Read moreSource§fn random_n<Container: FromIterator<Self>>(
rng: impl CryptoRngCore,
n_parties: usize,
) -> Container
fn random_n<Container: FromIterator<Self>>( rng: impl CryptoRngCore, n_parties: usize, ) -> Container
Generate one random field share per peer, with consistent MACs and keys across all peers.
fn random(_rng: impl CryptoRngCore) -> Self
Source§fn random_with(
rng: impl CryptoRngCore,
value_alphas: (SubfieldElement<F>, Vec<GlobalFieldKey<F>>),
) -> Self
fn random_with( rng: impl CryptoRngCore, value_alphas: (SubfieldElement<F>, Vec<GlobalFieldKey<F>>), ) -> Self
Generate a random field share from its global keys (alphas) and its share
Source§fn random_n_with_each<Container: FromIterator<Self>>(
rng: impl CryptoRngCore,
unauth_shares_and_alphas: impl IntoExactSizeIterator<Item = (SubfieldElement<F>, Vec<GlobalFieldKey<F>>)>,
) -> Container
fn random_n_with_each<Container: FromIterator<Self>>( rng: impl CryptoRngCore, unauth_shares_and_alphas: impl IntoExactSizeIterator<Item = (SubfieldElement<F>, Vec<GlobalFieldKey<F>>)>, ) -> Container
Generate one random field share per peer from their global keys (alphas).
fn random_n_with<Container: FromIterator<Self>>( rng: impl CryptoRngCore, size: usize, data: D, ) -> Container
Source§fn random_n_with<Container: FromIterator<Self>>(
rng: impl CryptoRngCore,
n_parties: usize,
(secret_value, all_alphas): (SubfieldElement<F>, Vec<Vec<GlobalFieldKey<F>>>),
) -> Container
fn random_n_with<Container: FromIterator<Self>>( rng: impl CryptoRngCore, n_parties: usize, (secret_value, all_alphas): (SubfieldElement<F>, Vec<Vec<GlobalFieldKey<F>>>), ) -> Container
Generate a random field share per peer from a value to secret share and global keys (alphas).
fn random_with( _source: impl CryptoRngCore, _data: (SubfieldElement<F>, Vec<Vec<GlobalFieldKey<F>>>), ) -> Self
fn random_n_with_each<Container: FromIterator<Self>>( rng: impl CryptoRngCore, all_data: impl IntoExactSizeIterator<Item = D>, ) -> Container
Source§fn random_with(
rng: impl CryptoRngCore,
n_parties_and_value: (usize, SubfieldElement<F>),
) -> Self
fn random_with( rng: impl CryptoRngCore, n_parties_and_value: (usize, SubfieldElement<F>), ) -> Self
Generate a random field share, with Macs and keys for all the other parties.
fn random_n_with<Container: FromIterator<Self>>( rng: impl CryptoRngCore, size: usize, data: D, ) -> Container
fn random_n_with_each<Container: FromIterator<Self>>( rng: impl CryptoRngCore, all_data: impl IntoExactSizeIterator<Item = D>, ) -> Container
Source§fn random_n_with<Container: FromIterator<Self>>(
rng: impl CryptoRngCore,
n_parties: usize,
value: SubfieldElement<F>,
) -> Container
fn random_n_with<Container: FromIterator<Self>>( rng: impl CryptoRngCore, n_parties: usize, value: SubfieldElement<F>, ) -> Container
Secret share a value among n parties, generating an authenticated share for each peer with consistent MACs and keys across all peers.
fn random_with(_rng: impl CryptoRngCore, _data: SubfieldElement<F>) -> Self
fn random_n_with_each<Container: FromIterator<Self>>( rng: impl CryptoRngCore, all_data: impl IntoExactSizeIterator<Item = D>, ) -> Container
Source§fn random_with(rng: impl CryptoRngCore, alphas: Vec<GlobalFieldKey<F>>) -> Self
fn random_with(rng: impl CryptoRngCore, alphas: Vec<GlobalFieldKey<F>>) -> Self
Generate a random field share from its global keys (alphas).
Source§fn random_n_with_each<Container: FromIterator<Self>>(
rng: impl CryptoRngCore,
all_alphas: impl IntoExactSizeIterator<Item = Vec<GlobalFieldKey<F>>>,
) -> Container
fn random_n_with_each<Container: FromIterator<Self>>( rng: impl CryptoRngCore, all_alphas: impl IntoExactSizeIterator<Item = Vec<GlobalFieldKey<F>>>, ) -> Container
Generate one random field share per peer from their global keys (alphas).
fn random_n_with<Container: FromIterator<Self>>( rng: impl CryptoRngCore, size: usize, data: D, ) -> Container
Source§fn random_with(rng: impl CryptoRngCore, n_parties: usize) -> Self
fn random_with(rng: impl CryptoRngCore, n_parties: usize) -> Self
Generate a random field share, with Macs and keys for all the other parties.
fn random_n_with<Container: FromIterator<Self>>( rng: impl CryptoRngCore, size: usize, data: D, ) -> Container
fn random_n_with_each<Container: FromIterator<Self>>( rng: impl CryptoRngCore, all_data: impl IntoExactSizeIterator<Item = D>, ) -> Container
Source§fn open_to(&self, peer: PeerIndex) -> Result<OpenFieldShare<F>, PrimitiveError>
fn open_to(&self, peer: PeerIndex) -> Result<OpenFieldShare<F>, PrimitiveError>
Open the share towards another peer.
Source§fn open_to_all_others(&self) -> impl ExactSizeIterator<Item = OpenFieldShare<F>>
fn open_to_all_others(&self) -> impl ExactSizeIterator<Item = OpenFieldShare<F>>
Open the share towards all other peers.
Source§fn reconstruct(
&self,
openings: &[OpenFieldShare<F>],
) -> Result<Self::Secret, PrimitiveError>
fn reconstruct( &self, openings: &[OpenFieldShare<F>], ) -> Result<Self::Secret, PrimitiveError>
Reconstruct a secret from openings coming from all other parties.
Source§type Opening = OpenFieldShare<F>
type Opening = OpenFieldShare<F>
Source§type Secret = SubfieldElement<F>
type Secret = SubfieldElement<F>
Source§fn reconstruct_all<T: Borrow<Self>>(
shares: &[T],
) -> Result<Self::Secret, PrimitiveError>
fn reconstruct_all<T: Borrow<Self>>( shares: &[T], ) -> Result<Self::Secret, PrimitiveError>
n secrets from the openings and
checking that they are all equal.Source§type Output = FieldShare<F>
type Output = FieldShare<F>
- operator.Source§type Output = FieldShare<F>
type Output = FieldShare<F>
- operator.Source§type Output = FieldShare<F>
type Output = FieldShare<F>
- operator.Source§type Output = FieldShare<F>
type Output = FieldShare<F>
- operator.Source§fn sub_assign(&mut self, other: &'a FieldShare<F>)
fn sub_assign(&mut self, other: &'a FieldShare<F>)
-= operation. Read moreSource§fn sub_assign(&mut self, rhs: FieldShare<F>)
fn sub_assign(&mut self, rhs: FieldShare<F>)
-= operation. Read moreSource§fn verify_from_peer_with(
&self,
open_share: &OpenFieldShare<F>,
peer: PeerIndex,
_verification_data: (),
) -> Result<(), PrimitiveError>
fn verify_from_peer_with( &self, open_share: &OpenFieldShare<F>, peer: PeerIndex, _verification_data: (), ) -> Result<(), PrimitiveError>
Check the MACs of the share received from another peer.
Source§fn verify_with(
&self,
open_shares: &[OpenFieldShare<F>],
_verification_data: (),
) -> Result<(), PrimitiveError>
fn verify_with( &self, open_shares: &[OpenFieldShare<F>], _verification_data: (), ) -> Result<(), PrimitiveError>
Check the MACs of each share received from all other peers.
Source§type VerificationData = ()
type VerificationData = ()
Source§fn verify_all_with(
shares: &[Self],
verification_data: Self::VerificationData,
) -> Result<(), PrimitiveError>
fn verify_all_with( shares: &[Self], verification_data: Self::VerificationData, ) -> Result<(), PrimitiveError>
Auto Trait Implementations§
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> FmtForward for T
impl<T> FmtForward for T
Source§fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
self to use its Binary implementation when Debug-formatted.Source§fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
self to use its Display implementation when
Debug-formatted.Source§fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
self to use its LowerExp implementation when
Debug-formatted.Source§fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
self to use its LowerHex implementation when
Debug-formatted.Source§fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
self to use its Octal implementation when Debug-formatted.Source§fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
self to use its Pointer implementation when
Debug-formatted.Source§fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
self to use its UpperExp implementation when
Debug-formatted.Source§fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
self to use its UpperHex implementation when
Debug-formatted.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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 moreSource§impl<T> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere
T: ?Sized,
Source§fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
Source§fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read moreSource§fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read moreSource§fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
Source§fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R,
) -> R
fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
Source§fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
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
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
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
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
self, then passes self.deref() into the pipe function.Source§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<F, T, S> RandomAuthenticatedForNPeersWith<F, T> for S
impl<F, T, S> RandomAuthenticatedForNPeersWith<F, T> for S
fn random_authenticated_for_n_peers_with<Container: FromIterator<Self>>( rng: impl CryptoRngCore, n_parties: usize, value: T, all_alphas: Vec<Vec<GlobalFieldKey<F>>>, ) -> Container
Source§impl<T> Tap for T
impl<T> Tap for T
Source§fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
Borrow<B> of a value. Read moreSource§fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
BorrowMut<B> of a value. Read moreSource§fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
AsRef<R> view of a value. Read moreSource§fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
AsMut<R> view of a value. Read moreSource§fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
Deref::Target of a value. Read moreSource§fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
Deref::Target of a value. Read moreSource§fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
.tap() only in debug builds, and is erased in release builds.Source§fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
.tap_mut() only in debug builds, and is erased in release
builds.Source§fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
.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
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
.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
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
.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
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
.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
fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
.tap_deref() only in debug builds, and is erased in release
builds.