Struct Hints

Source
pub struct Hints<H, const S: usize> { /* private fields */ }
Expand description

Batch of Hints that enforces inner vector size as well as shuffling, and also mitigates potential timing leaks at creation time.

  1. If fewer HintSeed items than S are supplied during creation, decoy HintSeed will fill the remaining slots.
  2. A new temporary K::SecretKey is generated, which is used as a one-off contribution to the group secrets used to encrypt the respective Hint’s messages.
  3. In order to make sure passive attackers don’t know which Hint to brute force, the Hints order should not be deterministic, so decoy and real Hints get shuffled before the result is returned.

In aggregate, this ensures that even if the same HintSeed is used to create multiple Hints instances, they are indistinguishable to passive observers that want to infer communication patterns by repeatedly polling a server or other intermediary.

Implementations§

Source§

impl<K: KeyPair, A: Aead + KeyInit, const L: usize, const S: usize> Hints<Hint<K, A, L>, S>
where Hint<K, A, L>: Hinting<K, L>,

Source

pub fn new( hint_seeds: &[HintSeed<K, L>], salt: &[u8], csprng: &mut impl CryptoRngCore, ) -> Result<Self, Error>
where HintSeed<K, L>: Decoy, K::SecretKey: RandomSecretKey,

Build shuffled batch of Hint instances from a HintSeed slice, salt, and an RNG, resulting in a total of S items.

Note: Although this associated function attempts to account for it, timing leaks MAY happen here. The mitigations’ effectiveness has not yet been independently verified.

Source

pub fn as_slice(&self) -> &[Hint<K, A, L>]

View as slice.

Source

pub fn from_bytes(bytes: &[u8]) -> Result<Self, Error>

Deserialize from byte slice.

Source

pub fn to_bytes(self) -> Vec<u8>

Serialize to byte vector.

Auto Trait Implementations§

§

impl<H, const S: usize> Freeze for Hints<H, S>

§

impl<H, const S: usize> RefUnwindSafe for Hints<H, S>
where H: RefUnwindSafe,

§

impl<H, const S: usize> Send for Hints<H, S>
where H: Send,

§

impl<H, const S: usize> Sync for Hints<H, S>
where H: Sync,

§

impl<H, const S: usize> Unpin for Hints<H, S>
where H: Unpin,

§

impl<H, const S: usize> UnwindSafe for Hints<H, S>
where H: UnwindSafe,

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

Source§

type Output = T

Should always be Self
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