Trait SphinxHeaderSpec

Source
pub trait SphinxHeaderSpec {
    type KeyId: BytesRepresentable + Clone;
    type Pseudonym: Pseudonym;
    type RelayerData: BytesRepresentable;
    type PacketReceiverData: BytesRepresentable;
    type SurbReceiverData: BytesRepresentable;
    type PRG: StreamCipher + StreamCipherSeek + KeyIvInit;
    type UH: UniversalHash + KeyInit;
Show 9 associated constants and 2 methods const MAX_HOPS: NonZeroUsize; const RELAYER_DATA_SIZE: usize = <Self::RelayerData>::SIZE; const SURB_RECEIVER_DATA_SIZE: usize = <Self::SurbReceiverData>::SIZE; const RECEIVER_DATA_SIZE: usize = <Self::PacketReceiverData>::SIZE; const KEY_ID_SIZE: NonZeroUsize = _; const TAG_SIZE: usize = <<Self::UH as crypto_traits::BlockSizeUser>::BlockSize>::USIZE; const ROUTING_INFO_LEN: usize = _; const HEADER_LEN: usize = _; const EXT_HEADER_LEN: usize = _; // Provided methods fn generate_filler(secrets: &[SharedSecret]) -> Result<Box<[u8]>> { ... } fn new_prg(secret: &SecretKey) -> Result<Self::PRG> { ... }
}
Expand description

Contains the necessary size and type specifications for the Sphinx packet header.

Required Associated Constants§

Source

const MAX_HOPS: NonZeroUsize

Maximum number of hops.

Provided Associated Constants§

Source

const RELAYER_DATA_SIZE: usize = <Self::RelayerData>::SIZE

Size of the additional data for relayers.

Source

const SURB_RECEIVER_DATA_SIZE: usize = <Self::SurbReceiverData>::SIZE

Size of the additional data included in SURBs.

Source

const RECEIVER_DATA_SIZE: usize = <Self::PacketReceiverData>::SIZE

Size of the additional data for the packet receiver.

Source

const KEY_ID_SIZE: NonZeroUsize = _

Size of the public key identifier

Source

const TAG_SIZE: usize = <<Self::UH as crypto_traits::BlockSizeUser>::BlockSize>::USIZE

Size of the one-time authenticator tag.

Source

const ROUTING_INFO_LEN: usize = _

Length of the header routing information per hop.

The value shall not be overridden.

Source

const HEADER_LEN: usize = _

Length of the whole Sphinx header.

The value shall not be overridden.

Source

const EXT_HEADER_LEN: usize = _

Extended header size used for computations.

The value shall not be overridden.

Required Associated Types§

Source

type KeyId: BytesRepresentable + Clone

Public key identifier type.

Source

type Pseudonym: Pseudonym

Pseudonym used to represent node for SURBs.

Source

type RelayerData: BytesRepresentable

Type representing additional data for relayers.

Source

type PacketReceiverData: BytesRepresentable

Type representing additional data delivered to the packet receiver.

It is delivered on both forward and return paths.

Source

type SurbReceiverData: BytesRepresentable

Type representing additional data delivered with each SURB to the packet receiver.

It is delivered only on the forward path.

Source

type PRG: StreamCipher + StreamCipherSeek + KeyIvInit

Pseudo-Random Generator function used to encrypt and decrypt the Sphinx header.

Source

type UH: UniversalHash + KeyInit

One-time authenticator used for Sphinx header tag.

Provided Methods§

Source

fn generate_filler(secrets: &[SharedSecret]) -> Result<Box<[u8]>>

Source

fn new_prg(secret: &SecretKey) -> Result<Self::PRG>

Instantiates a new Pseudo-Random Generator.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§