Struct prio::vdaf::prio2::Prio2

source ·
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

source

pub fn new(input_len: usize) -> Result<Self, VdafError>

Returns an instance of the VDAF for the given input length.

source

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

§

type PrepareState = Prio2PrepareState

State of the Aggregator during the Prepare process.
§

type PrepareShare = Prio2PrepareShare

The type of messages sent by each aggregator at each round of the Prepare Process. Read more
§

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>

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 more
source§

fn prepare_shares_to_prepare_message<M: IntoIterator<Item = Prio2PrepareShare>>( &self, _: &Self::AggregationParam, inputs: M ) -> Result<(), VdafError>

Preprocess a round of preparation shares into a single input to Self::prepare_next. Read more
source§

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’ PrepareShares 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 more
source§

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 Client<16> for Prio2

source§

fn shard( &self, measurement: &Vec<u32>, _nonce: &[u8; 16] ) -> Result<(Self::PublicShare, Vec<Share<FieldPrio2, 32>>), VdafError>

Shards a measurement into a public share and a sequence of input shares, one for each Aggregator. Read more
source§

impl Clone for Prio2

source§

fn clone(&self) -> Prio2

Returns a copy of the value. Read more
1.0.0 · source§

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

Performs copy-assignment from source. Read more
source§

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>

Combines aggregate shares into the aggregate result.
source§

impl Debug for Prio2

source§

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

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

impl Vdaf for Prio2

§

type Measurement = Vec<u32>

The type of Client measurement to be aggregated.
§

type AggregateResult = Vec<u32>

The aggregate result of the VDAF execution.
§

type AggregationParam = ()

The aggregation parameter, used by the Aggregators to map their input shares to output shares.
§

type PublicShare = ()

A public share sent by a Client.
§

type InputShare = Share<FieldPrio2, 32>

An input share sent by a Client.
§

type OutputShare = OutputShare<FieldPrio2>

An output share recovered from an input share by an Aggregator.
§

type AggregateShare = AggregateShare<FieldPrio2>

An Aggregator’s share of the aggregate result.
source§

fn algorithm_id(&self) -> u32

Return the VDAF’s algorithm ID.
source§

fn num_aggregators(&self) -> usize

The number of Aggregators. The Client generates as many input shares as there are Aggregators.
source§

fn domain_separation_tag(&self, usage: u16) -> [u8; 8]

Generate the domain separation tag for this VDAF. The output is used for domain separation by the XOF.

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> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Az for T

source§

fn az<Dst>(self) -> Dst
where T: Cast<Dst>,

Casts the value.
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<Src, Dst> CastFrom<Src> for Dst
where Src: Cast<Dst>,

source§

fn cast_from(src: Src) -> Dst

Casts the value.
source§

impl<T> CheckedAs for T

source§

fn checked_as<Dst>(self) -> Option<Dst>
where T: CheckedCast<Dst>,

Casts the value.
source§

impl<Src, Dst> CheckedCastFrom<Src> for Dst
where Src: CheckedCast<Dst>,

source§

fn checked_cast_from(src: Src) -> Option<Dst>

Casts the value.
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<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, 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<Src, Dst> LosslessTryInto<Dst> for Src
where Dst: LosslessTryFrom<Src>,

source§

fn lossless_try_into(self) -> Option<Dst>

Performs the conversion.
source§

impl<Src, Dst> LossyInto<Dst> for Src
where Dst: LossyFrom<Src>,

source§

fn lossy_into(self) -> Dst

Performs the conversion.
source§

impl<T> OverflowingAs for T

source§

fn overflowing_as<Dst>(self) -> (Dst, bool)
where T: OverflowingCast<Dst>,

Casts the value.
source§

impl<Src, Dst> OverflowingCastFrom<Src> for Dst
where Src: OverflowingCast<Dst>,

source§

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 A
where A: Aggregator<VERIFY_KEY_SIZE, NONCE_SIZE>,

§

type State = PingPongState<VERIFY_KEY_SIZE, NONCE_SIZE, A>

Specialization of PingPongState for this VDAF.
§

type ContinuedValue = PingPongContinuedValue<VERIFY_KEY_SIZE, NONCE_SIZE, A>

Specialization of PingPongContinuedValue for this VDAF.
§

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>

Initialize leader state using the leader’s input share. Corresponds to ping_pong_leader_init in VDAF. Read more
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>

Initialize helper state using the helper’s input share and the leader’s first prepare share. Corresponds to ping_pong_helper_init in VDAF. Read more
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>

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 more
source§

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 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.
§

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

§

type Output = T

Should always be Self
source§

impl<T> SaturatingAs for T

source§

fn saturating_as<Dst>(self) -> Dst
where T: SaturatingCast<Dst>,

Casts the value.
source§

impl<Src, Dst> SaturatingCastFrom<Src> for Dst
where Src: SaturatingCast<Dst>,

source§

fn saturating_cast_from(src: Src) -> Dst

Casts the value.
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,

§

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>,

§

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>,

§

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<T> UnwrappedAs for T

source§

fn unwrapped_as<Dst>(self) -> Dst
where T: UnwrappedCast<Dst>,

Casts the value.
source§

impl<Src, Dst> UnwrappedCastFrom<Src> for Dst
where Src: UnwrappedCast<Dst>,

source§

fn unwrapped_cast_from(src: Src) -> Dst

Casts the value.
source§

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

source§

fn vzip(self) -> V

source§

impl<T> WrappingAs for T

source§

fn wrapping_as<Dst>(self) -> Dst
where T: WrappingCast<Dst>,

Casts the value.
source§

impl<Src, Dst> WrappingCastFrom<Src> for Dst
where Src: WrappingCast<Dst>,

source§

fn wrapping_cast_from(src: Src) -> Dst

Casts the value.