Struct HoprSenderId
pub struct HoprSenderId(/* private fields */);Expand description
Identifier of a single packet sender.
This consists of two parts:
HoprSenderId::pseudonymof the senderHoprSenderId::surb_idis an identifier a single SURB that routes the packet back to the sender.
The surb_id always identifies a single SURB. The instance can be turned into a pseudorandom
sequence using HoprSenderId::into_sequence to create identifiers for more SURBs
with the same pseudonym.
Implementations§
§impl HoprSenderId
impl HoprSenderId
pub fn new(pseudonym: &SimplePseudonym) -> HoprSenderId
pub fn from_pseudonym_and_id( pseudonym: &SimplePseudonym, id: [u8; 8], ) -> HoprSenderId
pub fn pseudonym(&self) -> SimplePseudonym
pub fn surb_id(&self) -> [u8; 8]
pub fn into_sequence(self) -> impl Iterator<Item = HoprSenderId>
pub fn into_sequence(self) -> impl Iterator<Item = HoprSenderId>
Creates a pseudorandom sequence of IDs.
Each item has the same pseudonym
but different surb_id.
The surb_id of the n-th item (n > 1) is computed as Blake3(n || I_prev)
where I_prev is the whole n-1-th ID, the n is represented as big-endian and
|| denotes byte-array concatenation.
The first item (n = 1) is always self.
The entropy of the whole pseudorandom sequence is completely given by self (the first
item in the sequence). It follows that the next element of the sequence can be computed
by just knowing any preceding element; therefore, the sequence is fully predictable
once an element is known.
Trait Implementations§
§impl AsRef<[u8]> for HoprSenderId
impl AsRef<[u8]> for HoprSenderId
§impl BytesRepresentable for HoprSenderId
impl BytesRepresentable for HoprSenderId
§impl Clone for HoprSenderId
impl Clone for HoprSenderId
§fn clone(&self) -> HoprSenderId
fn clone(&self) -> HoprSenderId
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more§impl Debug for HoprSenderId
impl Debug for HoprSenderId
§impl<'de> Deserialize<'de> for HoprSenderId
impl<'de> Deserialize<'de> for HoprSenderId
§fn deserialize<__D>(
__deserializer: __D,
) -> Result<HoprSenderId, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<HoprSenderId, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
§impl Hash for HoprSenderId
impl Hash for HoprSenderId
§impl PartialEq for HoprSenderId
impl PartialEq for HoprSenderId
§impl Randomizable for HoprSenderId
impl Randomizable for HoprSenderId
§fn random() -> HoprSenderId
fn random() -> HoprSenderId
§impl Serialize for HoprSenderId
impl Serialize for HoprSenderId
§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
§impl<'a> TryFrom<&'a [u8]> for HoprSenderId
impl<'a> TryFrom<&'a [u8]> for HoprSenderId
impl Copy for HoprSenderId
impl Eq for HoprSenderId
impl StructuralPartialEq for HoprSenderId
Auto Trait Implementations§
impl Freeze for HoprSenderId
impl RefUnwindSafe for HoprSenderId
impl Send for HoprSenderId
impl Sync for HoprSenderId
impl Unpin for HoprSenderId
impl UnwindSafe for HoprSenderId
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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>
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>
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§impl<T> Pointable for T
impl<T> Pointable for T
§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
§impl<T> ToHex for Twhere
T: BytesRepresentable,
impl<T> ToHex for Twhere
T: BytesRepresentable,
Source§impl<T> ToHex for T
impl<T> ToHex for T
Source§fn encode_hex<U>(&self) -> Uwhere
U: FromIterator<char>,
fn encode_hex<U>(&self) -> Uwhere
U: FromIterator<char>,
self into the result. Lower case
letters are used (e.g. f9b4ca)Source§fn encode_hex_upper<U>(&self) -> Uwhere
U: FromIterator<char>,
fn encode_hex_upper<U>(&self) -> Uwhere
U: FromIterator<char>,
self into the result. Upper case
letters are used (e.g. F9B4CA)§impl<T> ToHex for T
impl<T> ToHex for T
§fn encode_hex<U>(&self) -> Uwhere
U: FromIterator<char>,
fn encode_hex<U>(&self) -> Uwhere
U: FromIterator<char>,
ToHexExt insteadself into the result.
Lower case letters are used (e.g. f9b4ca).§fn encode_hex_upper<U>(&self) -> Uwhere
U: FromIterator<char>,
fn encode_hex_upper<U>(&self) -> Uwhere
U: FromIterator<char>,
ToHexExt insteadself into the result.
Upper case letters are used (e.g. F9B4CA).§impl<T> ToHexExt for T
impl<T> ToHexExt for T
§fn encode_hex(&self) -> String
fn encode_hex(&self) -> String
self into the result.
Lower case letters are used (e.g. f9b4ca).§fn encode_hex_upper(&self) -> String
fn encode_hex_upper(&self) -> String
self into the result.
Upper case letters are used (e.g. F9B4CA).§fn encode_hex_with_prefix(&self) -> String
fn encode_hex_with_prefix(&self) -> String
self into the result with prefix 0x.
Lower case letters are used (e.g. 0xf9b4ca).§fn encode_hex_upper_with_prefix(&self) -> String
fn encode_hex_upper_with_prefix(&self) -> String
self into the result with prefix 0X.
Upper case letters are used (e.g. 0xF9B4CA).