pub struct Prio2 { /* private fields */ }
Available on crate features
crypto-dependencies
and experimental
only.Expand description
The Prio2 VDAF. It supports the same measurement type as
Prio3SumVec
with bits == 1
but uses the proof system and
finite field deployed in ENPA.
Implementations§
source§impl Prio2
impl Prio2
sourcepub fn new(input_len: usize) -> Result<Self, VdafError>
pub fn new(input_len: usize) -> Result<Self, VdafError>
Returns an instance of the VDAF for the given input length.
sourcepub fn prepare_init_with_query_rand(
&self,
query_rand: FieldPrio2,
input_share: &Share<FieldPrio2, 32>,
is_leader: bool
) -> Result<(Prio2PrepareState, Prio2PrepareShare), VdafError>
pub fn prepare_init_with_query_rand( &self, query_rand: FieldPrio2, input_share: &Share<FieldPrio2, 32>, is_leader: bool ) -> Result<(Prio2PrepareState, Prio2PrepareShare), VdafError>
Prepare an input share for aggregation using the given field element query_rand
to
compute the verifier share.
In the Aggregator
trait implementation for Prio2
, the query randomness is computed
jointly by the Aggregators. This method is designed to be used in applications, like ENPA,
in which the query randomness is instead chosen by a third-party.
Trait Implementations§
source§impl Aggregator<32, 16> for Prio2
impl Aggregator<32, 16> for Prio2
§type PrepareState = Prio2PrepareState
type PrepareState = Prio2PrepareState
State of the Aggregator during the Prepare process.
The type of messages sent by each aggregator at each round of the Prepare Process. Read more
§type PrepareMessage = ()
type PrepareMessage = ()
Result of preprocessing a round of preparation shares. This is used by all aggregators as an
input to the next round of the Prepare Process. Read more
source§fn prepare_init(
&self,
agg_key: &[u8; 32],
agg_id: usize,
_agg_param: &Self::AggregationParam,
nonce: &[u8; 16],
_public_share: &Self::PublicShare,
input_share: &Share<FieldPrio2, 32>
) -> Result<(Prio2PrepareState, Prio2PrepareShare), VdafError>
fn prepare_init( &self, agg_key: &[u8; 32], agg_id: usize, _agg_param: &Self::AggregationParam, nonce: &[u8; 16], _public_share: &Self::PublicShare, input_share: &Share<FieldPrio2, 32> ) -> Result<(Prio2PrepareState, Prio2PrepareShare), VdafError>
Begins the Prepare process with the other Aggregators. The
Self::PrepareState
returned
is passed to Self::prepare_next
to get this aggregator’s first-round prepare message. Read morePreprocess a round of preparation shares into a single input to
Self::prepare_next
. Read moresource§fn prepare_next(
&self,
state: Prio2PrepareState,
_input: ()
) -> Result<PrepareTransition<Self, 32, 16>, VdafError>
fn prepare_next( &self, state: Prio2PrepareState, _input: () ) -> Result<PrepareTransition<Self, 32, 16>, VdafError>
Compute the next state transition from the current state and the previous round of input
messages. If this returns
PrepareTransition::Continue
, then the returned
Self::PrepareShare
should be combined with the other Aggregators’ PrepareShare
s from
this round and passed into another call to this method. This continues until this method
returns PrepareTransition::Finish
, at which point the returned output share may be
aggregated. If the method returns an error, the aggregator should consider its input share
invalid and not attempt to process it any further. Read moresource§fn aggregate<M: IntoIterator<Item = OutputShare<FieldPrio2>>>(
&self,
_agg_param: &Self::AggregationParam,
out_shares: M
) -> Result<AggregateShare<FieldPrio2>, VdafError>
fn aggregate<M: IntoIterator<Item = OutputShare<FieldPrio2>>>( &self, _agg_param: &Self::AggregationParam, out_shares: M ) -> Result<AggregateShare<FieldPrio2>, VdafError>
Aggregates a sequence of output shares into an aggregate share.
source§impl Collector for Prio2
impl Collector for Prio2
source§fn unshard<M: IntoIterator<Item = AggregateShare<FieldPrio2>>>(
&self,
_agg_param: &Self::AggregationParam,
agg_shares: M,
_num_measurements: usize
) -> Result<Vec<u32>, VdafError>
fn unshard<M: IntoIterator<Item = AggregateShare<FieldPrio2>>>( &self, _agg_param: &Self::AggregationParam, agg_shares: M, _num_measurements: usize ) -> Result<Vec<u32>, VdafError>
Combines aggregate shares into the aggregate result.
source§impl Vdaf for Prio2
impl Vdaf for Prio2
§type Measurement = Vec<u32>
type Measurement = Vec<u32>
The type of Client measurement to be aggregated.
§type AggregateResult = Vec<u32>
type AggregateResult = Vec<u32>
The aggregate result of the VDAF execution.
§type AggregationParam = ()
type AggregationParam = ()
The aggregation parameter, used by the Aggregators to map their input shares to output
shares.
A public share sent by a Client.
An input share sent by a Client.
An output share recovered from an input share by an Aggregator.
An Aggregator’s share of the aggregate result.
source§fn algorithm_id(&self) -> u32
fn algorithm_id(&self) -> u32
Return the VDAF’s algorithm ID.
source§fn num_aggregators(&self) -> usize
fn num_aggregators(&self) -> usize
The number of Aggregators. The Client generates as many input shares as there are
Aggregators.
Auto Trait Implementations§
impl Freeze for Prio2
impl RefUnwindSafe for Prio2
impl Send for Prio2
impl Sync for Prio2
impl Unpin for Prio2
impl UnwindSafe for Prio2
Blanket Implementations§
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
Mutably borrows from an owned value. Read more
source§impl<T> CheckedAs for T
impl<T> CheckedAs for T
source§fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
Casts the value.
source§impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
source§fn checked_cast_from(src: Src) -> Option<Dst>
fn checked_cast_from(src: Src) -> Option<Dst>
Casts the value.
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,
Causes
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,
Causes
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,
Causes
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,
Causes
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,
Causes
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,
Causes
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,
Causes
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,
Causes
self
to use its UpperHex
implementation when
Debug
-formatted.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>
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 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>
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 moresource§impl<Src, Dst> LosslessTryInto<Dst> for Srcwhere
Dst: LosslessTryFrom<Src>,
impl<Src, Dst> LosslessTryInto<Dst> for Srcwhere
Dst: LosslessTryFrom<Src>,
source§fn lossless_try_into(self) -> Option<Dst>
fn lossless_try_into(self) -> Option<Dst>
Performs the conversion.
source§impl<Src, Dst> LossyInto<Dst> for Srcwhere
Dst: LossyFrom<Src>,
impl<Src, Dst> LossyInto<Dst> for Srcwhere
Dst: LossyFrom<Src>,
source§fn lossy_into(self) -> Dst
fn lossy_into(self) -> Dst
Performs the conversion.
source§impl<T> OverflowingAs for T
impl<T> OverflowingAs for T
source§fn overflowing_as<Dst>(self) -> (Dst, bool)where
T: OverflowingCast<Dst>,
fn overflowing_as<Dst>(self) -> (Dst, bool)where
T: OverflowingCast<Dst>,
Casts the value.
source§impl<Src, Dst> OverflowingCastFrom<Src> for Dstwhere
Src: OverflowingCast<Dst>,
impl<Src, Dst> OverflowingCastFrom<Src> for Dstwhere
Src: OverflowingCast<Dst>,
source§fn overflowing_cast_from(src: Src) -> (Dst, bool)
fn overflowing_cast_from(src: Src) -> (Dst, bool)
Casts the value.
source§impl<const VERIFY_KEY_SIZE: usize, const NONCE_SIZE: usize, A> PingPongTopology<VERIFY_KEY_SIZE, NONCE_SIZE> for Awhere
A: Aggregator<VERIFY_KEY_SIZE, NONCE_SIZE>,
impl<const VERIFY_KEY_SIZE: usize, const NONCE_SIZE: usize, A> PingPongTopology<VERIFY_KEY_SIZE, NONCE_SIZE> for Awhere
A: Aggregator<VERIFY_KEY_SIZE, NONCE_SIZE>,
§type State = PingPongState<VERIFY_KEY_SIZE, NONCE_SIZE, A>
type State = PingPongState<VERIFY_KEY_SIZE, NONCE_SIZE, A>
Specialization of
PingPongState
for this VDAF.§type ContinuedValue = PingPongContinuedValue<VERIFY_KEY_SIZE, NONCE_SIZE, A>
type ContinuedValue = PingPongContinuedValue<VERIFY_KEY_SIZE, NONCE_SIZE, A>
Specialization of
PingPongContinuedValue
for this VDAF.§type Transition = PingPongTransition<VERIFY_KEY_SIZE, NONCE_SIZE, A>
type Transition = PingPongTransition<VERIFY_KEY_SIZE, NONCE_SIZE, A>
Specializaton of
PingPongTransition
for this VDAF.source§fn leader_initialized(
&self,
verify_key: &[u8; VERIFY_KEY_SIZE],
agg_param: &<A as Vdaf>::AggregationParam,
nonce: &[u8; NONCE_SIZE],
public_share: &<A as Vdaf>::PublicShare,
input_share: &<A as Vdaf>::InputShare
) -> Result<(<A as PingPongTopology<VERIFY_KEY_SIZE, NONCE_SIZE>>::State, PingPongMessage), PingPongError>
fn leader_initialized( &self, verify_key: &[u8; VERIFY_KEY_SIZE], agg_param: &<A as Vdaf>::AggregationParam, nonce: &[u8; NONCE_SIZE], public_share: &<A as Vdaf>::PublicShare, input_share: &<A as Vdaf>::InputShare ) -> Result<(<A as PingPongTopology<VERIFY_KEY_SIZE, NONCE_SIZE>>::State, PingPongMessage), PingPongError>
source§fn helper_initialized(
&self,
verify_key: &[u8; VERIFY_KEY_SIZE],
agg_param: &<A as Vdaf>::AggregationParam,
nonce: &[u8; NONCE_SIZE],
public_share: &<A as Vdaf>::PublicShare,
input_share: &<A as Vdaf>::InputShare,
inbound: &PingPongMessage
) -> Result<<A as PingPongTopology<VERIFY_KEY_SIZE, NONCE_SIZE>>::Transition, PingPongError>
fn helper_initialized( &self, verify_key: &[u8; VERIFY_KEY_SIZE], agg_param: &<A as Vdaf>::AggregationParam, nonce: &[u8; NONCE_SIZE], public_share: &<A as Vdaf>::PublicShare, input_share: &<A as Vdaf>::InputShare, inbound: &PingPongMessage ) -> Result<<A as PingPongTopology<VERIFY_KEY_SIZE, NONCE_SIZE>>::Transition, PingPongError>
source§fn leader_continued(
&self,
leader_state: <A as PingPongTopology<VERIFY_KEY_SIZE, NONCE_SIZE>>::State,
agg_param: &<A as Vdaf>::AggregationParam,
inbound: &PingPongMessage
) -> Result<<A as PingPongTopology<VERIFY_KEY_SIZE, NONCE_SIZE>>::ContinuedValue, PingPongError>
fn leader_continued( &self, leader_state: <A as PingPongTopology<VERIFY_KEY_SIZE, NONCE_SIZE>>::State, agg_param: &<A as Vdaf>::AggregationParam, inbound: &PingPongMessage ) -> Result<<A as PingPongTopology<VERIFY_KEY_SIZE, NONCE_SIZE>>::ContinuedValue, PingPongError>
Continue preparation based on the leader’s current state and an incoming
PingPongMessage
from the helper. Corresponds to ping_pong_leader_continued
in VDAF. Read moresource§fn helper_continued(
&self,
helper_state: <A as PingPongTopology<VERIFY_KEY_SIZE, NONCE_SIZE>>::State,
agg_param: &<A as Vdaf>::AggregationParam,
inbound: &PingPongMessage
) -> Result<<A as PingPongTopology<VERIFY_KEY_SIZE, NONCE_SIZE>>::ContinuedValue, PingPongError>
fn helper_continued( &self, helper_state: <A as PingPongTopology<VERIFY_KEY_SIZE, NONCE_SIZE>>::State, agg_param: &<A as Vdaf>::AggregationParam, inbound: &PingPongMessage ) -> Result<<A as PingPongTopology<VERIFY_KEY_SIZE, NONCE_SIZE>>::ContinuedValue, PingPongError>
PingPongContinue preparation based on the helper’s current state and an incoming
PingPongMessage
from the leader. Corresponds to ping_pong_helper_contnued
in VDAF. 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,
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) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
Borrows
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,
Mutably borrows
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
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
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
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
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
Borrows
self
, then passes self.deref()
into the pipe function.source§impl<T> Pointable for T
impl<T> Pointable for T
source§impl<T> SaturatingAs for T
impl<T> SaturatingAs for T
source§fn saturating_as<Dst>(self) -> Dstwhere
T: SaturatingCast<Dst>,
fn saturating_as<Dst>(self) -> Dstwhere
T: SaturatingCast<Dst>,
Casts the value.
source§impl<Src, Dst> SaturatingCastFrom<Src> for Dstwhere
Src: SaturatingCast<Dst>,
impl<Src, Dst> SaturatingCastFrom<Src> for Dstwhere
Src: SaturatingCast<Dst>,
source§fn saturating_cast_from(src: Src) -> Dst
fn saturating_cast_from(src: Src) -> Dst
Casts the value.
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
Immutable access to the
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
Mutable access to the
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
Immutable access to the
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
Mutable access to the
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
Immutable access to the
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
Mutable access to the
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
Calls
.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
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
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
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
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
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
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
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
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
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
fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
Calls
.tap_deref()
only in debug builds, and is erased in release
builds.source§impl<T> UnwrappedAs for T
impl<T> UnwrappedAs for T
source§fn unwrapped_as<Dst>(self) -> Dstwhere
T: UnwrappedCast<Dst>,
fn unwrapped_as<Dst>(self) -> Dstwhere
T: UnwrappedCast<Dst>,
Casts the value.
source§impl<Src, Dst> UnwrappedCastFrom<Src> for Dstwhere
Src: UnwrappedCast<Dst>,
impl<Src, Dst> UnwrappedCastFrom<Src> for Dstwhere
Src: UnwrappedCast<Dst>,
source§fn unwrapped_cast_from(src: Src) -> Dst
fn unwrapped_cast_from(src: Src) -> Dst
Casts the value.
source§impl<T> WrappingAs for T
impl<T> WrappingAs for T
source§fn wrapping_as<Dst>(self) -> Dstwhere
T: WrappingCast<Dst>,
fn wrapping_as<Dst>(self) -> Dstwhere
T: WrappingCast<Dst>,
Casts the value.
source§impl<Src, Dst> WrappingCastFrom<Src> for Dstwhere
Src: WrappingCast<Dst>,
impl<Src, Dst> WrappingCastFrom<Src> for Dstwhere
Src: WrappingCast<Dst>,
source§fn wrapping_cast_from(src: Src) -> Dst
fn wrapping_cast_from(src: Src) -> Dst
Casts the value.