gm-sm4

Crates.iogm-sm4
lib.rsgm-sm4
version0.10.0
sourcesrc
created_at2023-04-17 02:58:31.044102
updated_at2023-04-17 03:11:33.78577
descriptionA Rust Implementation of China's Standards of Encryption Algorithms SM4
homepagehttps://github.com/CrayfishGo/gm-rs.git
repository
max_upload_size
id841107
size17,534
(CrayfishGo)

documentation

https://docs.rs/gm-sm4/

README

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

Commit count: 0

cargo fmt