pub struct SphinxHeader {
pub ephemeral_key: PublicKey,
pub routing_info: [u8; 400],
pub mac: [u8; 32],
pub nonce: u64,
}Fields§
§ephemeral_key: PublicKey§routing_info: [u8; 400]§mac: [u8; 32]§nonce: u64Implementations§
Source§impl SphinxHeader
impl SphinxHeader
Sourcepub fn compute_replay_tag(&self) -> [u8; 32]
pub fn compute_replay_tag(&self) -> [u8; 32]
Blake3 hash of (ephemeral_key, mac, nonce) for replay detection.
Sourcepub fn process(
&self,
node_sk: &X25519SecretKey,
body: Vec<u8>,
) -> Result<ProcessOutput, SphinxError>
pub fn process( &self, node_sk: &X25519SecretKey, body: Vec<u8>, ) -> Result<ProcessOutput, SphinxError>
Process a Sphinx packet at this hop: ECDH, MAC verify, decrypt routing + body, blind key.
pub fn from_bytes(bytes: &[u8]) -> Result<(Self, &[u8]), SphinxError>
pub fn to_bytes(&self, payload: &[u8]) -> Vec<u8> ⓘ
pub fn verify_pow(&self, difficulty: u32) -> bool
Sourcepub fn solve_pow(&mut self, difficulty: u32) -> Result<(), SphinxError>
pub fn solve_pow(&mut self, difficulty: u32) -> Result<(), SphinxError>
Solves PoW by brute-forcing nonces (single-threaded).
Sourcepub fn solve_pow_parallel(
&mut self,
difficulty: u32,
threads: usize,
) -> Result<(), SphinxError>
pub fn solve_pow_parallel( &mut self, difficulty: u32, threads: usize, ) -> Result<(), SphinxError>
Solves PoW using the parallel solver.
Trait Implementations§
Source§impl Clone for SphinxHeader
impl Clone for SphinxHeader
Source§fn clone(&self) -> SphinxHeader
fn clone(&self) -> SphinxHeader
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for SphinxHeader
impl Debug for SphinxHeader
Source§impl<'de> Deserialize<'de> for SphinxHeader
impl<'de> Deserialize<'de> for SphinxHeader
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl PartialEq for SphinxHeader
impl PartialEq for SphinxHeader
Source§impl Serialize for SphinxHeader
impl Serialize for SphinxHeader
impl StructuralPartialEq for SphinxHeader
Auto Trait Implementations§
impl Freeze for SphinxHeader
impl RefUnwindSafe for SphinxHeader
impl Send for SphinxHeader
impl Sync for SphinxHeader
impl Unpin for SphinxHeader
impl UnsafeUnpin for SphinxHeader
impl UnwindSafe for SphinxHeader
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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>
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 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>
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