Enum shadowsocks_crypto::v1::Cipher [−][src]
pub enum Cipher {
Dummy(DummyCipher),
Aead(AeadCipher),
}Unified interface of Ciphers
Variants
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]
#[must_use]
pub fn decrypt_packet(&mut self, pkt: &mut [u8]) -> boolDecrypt 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]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized, [src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized, [src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T[src]
impl<T> From<T> for T[src]
impl<T, U> Into<U> for T where
U: From<T>, [src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>, [src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>, [src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,