pub struct PaddingCell {
pub payload: Vec<u8>,
}Expand description
Fixed-size padding cell for traffic analysis resistance.
Padding cells are used to maintain constant traffic patterns and prevent traffic analysis attacks. The payload is random data that is ignored by the receiver.
§Wire Format
[ CircID ][ 0 (PADDING) ][ 509 bytes random payload ]§Example
use stem_rs::client::cell::PaddingCell;
use stem_rs::client::datatype::LinkProtocol;
// Create with random payload
let cell = PaddingCell::new();
// Create with specific payload
let payload = vec![0u8; 509];
let cell = PaddingCell::with_payload(payload).unwrap();Fields§
§payload: Vec<u8>The padding payload (exactly 509 bytes).
Implementations§
Source§impl PaddingCell
impl PaddingCell
Sourcepub fn new() -> Self
pub fn new() -> Self
Creates a new padding cell with random payload.
The payload is filled with cryptographically random bytes.
Sourcepub fn with_payload(payload: Vec<u8>) -> Result<Self, Error>
pub fn with_payload(payload: Vec<u8>) -> Result<Self, Error>
Creates a padding cell with a specific payload.
§Arguments
payload- Must be exactly 509 bytes
§Errors
Returns Error::Protocol if payload is not exactly 509 bytes.
Trait Implementations§
Source§impl Clone for PaddingCell
impl Clone for PaddingCell
Source§fn clone(&self) -> PaddingCell
fn clone(&self) -> PaddingCell
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 PaddingCell
impl Debug for PaddingCell
Source§impl Default for PaddingCell
impl Default for PaddingCell
Source§impl PartialEq for PaddingCell
impl PartialEq for PaddingCell
impl StructuralPartialEq for PaddingCell
Auto Trait Implementations§
impl Freeze for PaddingCell
impl RefUnwindSafe for PaddingCell
impl Send for PaddingCell
impl Sync for PaddingCell
impl Unpin for PaddingCell
impl UnwindSafe for PaddingCell
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