2 unstable releases
0.10.0 | Apr 17, 2023 |
---|---|
0.9.0 | Apr 17, 2023 |
#2183 in Cryptography
18KB
376 lines
gm-sm4
A Pure Rust High-Performance Implementation of China's Standards of Encryption Algorithms SM4
Example
use crate::Sm4Cipher;
use hex_literal::hex;
fn main() {
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());
}
Dependencies
~22KB