Skip to main content

Hints

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, L: ArraySize, const S: usize> Hints<Hint<K, A, L>, S>
where Hint<K, A, L>: HintSized<K, A, L> + Hinting<K, L>,

Source

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

Build shuffled batch of Hint instances from a HintSeed slice, context, 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.

Trait Implementations§

Source§

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

Source§

fn clone(&self) -> Hints<H, S>

Returns a duplicate 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<H: Debug, const S: usize> Debug for Hints<H, S>

Source§

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

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

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

Source§

fn from_iter<I: IntoIterator<Item = H>>(iter: I) -> Self

Creates a value from an iterator. Read more

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> UnsafeUnpin for Hints<H, S>

§

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