Enum shadowsocks_crypto::v1::Cipher[][src]

pub enum Cipher {
    Dummy(DummyCipher),
    Aead(AeadCipher),
}

Unified interface of Ciphers

Variants

Dummy(DummyCipher)
Aead(AeadCipher)

Implementations

impl Cipher[src]

pub fn new(kind: CipherKind, key: &[u8], iv_or_salt: &[u8]) -> Cipher[src]

Create a new Cipher of kind

  • Stream Ciphers initialize with IV
  • AEAD Ciphers initialize with SALT

pub fn category(&self) -> CipherCategory[src]

Get the CipherCategory of the current cipher

pub fn kind(&self) -> CipherKind[src]

Get the CipherKind of the current cipher

pub fn tag_len(&self) -> usize[src]

Get the TAG length of AEAD ciphers

pub fn encrypt_packet(&mut self, pkt: &mut [u8])[src]

Encrypt a packet. Encrypted result will be written in pkt

  • Stream Ciphers: the size of input and output packets are the same
  • AEAD Ciphers: the size of output must be at least input.len() + TAG_LEN

#[must_use]
pub fn decrypt_packet(&mut self, pkt: &mut [u8]) -> bool
[src]

Decrypt a packet. Decrypted result will be written in pkt

  • Stream Ciphers: the size of input and output packets are the same
  • AEAD Ciphers: the size of output is input.len() - TAG_LEN

Auto Trait Implementations

impl RefUnwindSafe for Cipher

impl Send for Cipher

impl Sync for Cipher

impl Unpin for Cipher

impl UnwindSafe for Cipher

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

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