[−][src]Struct camellia_rs::CamelliaCipher
A structure representing cipher.
Methods
impl CamelliaCipher
[src]
pub fn new(key: &[u8]) -> Result<Self, InvalidKeyLength>
[src]
Creates new CamelliaCipher instance from variable length key.
Errors
If key.len() is other than 16, 24 and 32, an error will be returned.
Examples
let key = [0u8; 16]; assert!(CamelliaCipher::new(&key).is_ok()); let key = [0u8; 17]; assert!(CamelliaCipher::new(&key).is_err());
pub fn encrypt(&self, block: &mut Block)
[src]
Encrypts given block in-place.
Examples
let key = [0u8; 16]; let data = [0u8; 16]; let cipher = CamelliaCipher::new(&key).unwrap(); let mut block = Block::from(data); cipher.encrypt(&mut block); let encrypted: [u8; 16] = block.into();
pub fn decrypt(&self, block: &mut Block)
[src]
Decrypts given block in-place.
Examples
let key = [0u8; 16]; let data = [0u8; 16]; let cipher = CamelliaCipher::new(&key).unwrap(); let mut block = Block::from(data); cipher.decrypt(&mut block); let decrypted: [u8; 16] = block.into();
Trait Implementations
impl Clone for CamelliaCipher
[src]
fn clone(&self) -> CamelliaCipher
[src]
default fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl Debug for CamelliaCipher
[src]
Auto Trait Implementations
impl Send for CamelliaCipher
impl Sync for CamelliaCipher
Blanket Implementations
impl<T> From for T
[src]
impl<T, U> Into for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
impl<T, U> TryFrom for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T> Borrow for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T, U> TryInto 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.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,