pub struct Sm4Cipher { /* private fields */ }Expand description
SM4 block cipher.
§Example
fn main() {
use hex_literal::hex;
use gm_rs::sm4::Sm4Cipher;
let key = hex!("0123456789abcdeffedcba9876543210");
let plaintext = key.clone();
let ciphertext = hex!("681edf34d206965e86b3e94f536e4246");
let cipher = Sm4Cipher::new(&key).unwrap();
let enc = cipher.encrypt(&plaintext).unwrap();
assert_eq!(&ciphertext, enc.as_slice());
}Implementations§
Trait Implementations§
impl Eq for Sm4Cipher
impl StructuralPartialEq for Sm4Cipher
Auto Trait Implementations§
impl Freeze for Sm4Cipher
impl RefUnwindSafe for Sm4Cipher
impl Send for Sm4Cipher
impl Sync for Sm4Cipher
impl Unpin for Sm4Cipher
impl UnwindSafe for Sm4Cipher
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