pub struct Cipher { /* private fields */ }Expand description
Main AES-CBC Cipher structure.
Usage:
extern crate dumb_crypto;
use::dumb_crypto::aes::BLOCK_SIZE;
use::dumb_crypto::aes_cbc::Cipher;
let iv = [
0x4c, 0xb4, 0x52, 0xd6, 0x78, 0xca, 0x94, 0x61,
0x92, 0xcd, 0xc6, 0x91, 0xb7, 0xab, 0x61, 0x76,
];
let key: [u8; 16] = [
0x69, 0xc2, 0xa9, 0xe6, 0x2b, 0x61, 0x30, 0x60,
0xc9, 0x79, 0x7b, 0xdc, 0xe4, 0xf6, 0x40, 0x8e,
];
let mut cipher = Cipher::new(iv);
cipher.init(&key).unwrap();
let mut ciphertext = cipher.write("aes-cbc with iv".as_bytes()).unwrap();
ciphertext.append(&mut cipher.flush().unwrap());Implementations§
Source§impl Cipher
impl Cipher
Auto Trait Implementations§
impl Freeze for Cipher
impl RefUnwindSafe for Cipher
impl Send for Cipher
impl Sync for Cipher
impl Unpin for Cipher
impl UnsafeUnpin for Cipher
impl UnwindSafe for Cipher
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