2个不稳定版本

0.10.0 2023年4月17日
0.9.0 2023年4月17日

加密学中排名#2314

每月下载量35

MIT许可MIT

18KB
376

gm-sm4

中国加密算法标准SM4的纯Rust高性能实现

示例

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());
}

依赖项

~22KB