hopr_crypto_sphinx::shared_keys

Struct SharedKeys

Source
pub struct SharedKeys<E: Scalar, G: GroupElement<E>> {
    pub alpha: Alpha<G::AlphaLen>,
    pub secrets: Vec<SharedSecret>,
    /* private fields */
}
Expand description

Structure containing shared keys for peers using the Sphinx algorithm.

Fields§

§alpha: Alpha<G::AlphaLen>§secrets: Vec<SharedSecret>

Implementations§

Source§

impl<E: Scalar, G: GroupElement<E>> SharedKeys<E, G>

Source

pub fn generate(peer_group_elements: Vec<G>) -> Result<SharedKeys<E, G>>

Generates shared secrets given the group element of the peers. The order of the peer group elements is preserved for resulting shared keys.

Source

pub fn forward_transform( alpha: &Alpha<G::AlphaLen>, private_scalar: &E, public_group_element: &G, ) -> Result<(Alpha<G::AlphaLen>, SharedSecret)>

Calculates the forward transformation for the given the local private key. The public_group_element is a precomputed group element associated to the private key for efficiency.

Auto Trait Implementations§

§

impl<E, G> Freeze for SharedKeys<E, G>
where <<G as GroupElement<E>>::AlphaLen as ArrayLength<u8>>::ArrayType: Freeze,

§

impl<E, G> RefUnwindSafe for SharedKeys<E, G>
where <<G as GroupElement<E>>::AlphaLen as ArrayLength<u8>>::ArrayType: RefUnwindSafe, E: RefUnwindSafe, G: RefUnwindSafe,

§

impl<E, G> Send for SharedKeys<E, G>
where E: Send, G: Send,

§

impl<E, G> Sync for SharedKeys<E, G>
where E: Sync, G: Sync,

§

impl<E, G> Unpin for SharedKeys<E, G>
where <<G as GroupElement<E>>::AlphaLen as ArrayLength<u8>>::ArrayType: Unpin, E: Unpin, G: Unpin,

§

impl<E, G> UnwindSafe for SharedKeys<E, G>
where <<G as GroupElement<E>>::AlphaLen as ArrayLength<u8>>::ArrayType: UnwindSafe, E: UnwindSafe, G: 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.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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.
§

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

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

impl<T> JsonSchemaMaybe for T