feat: update bench.rs

This commit is contained in:
2023-09-03 23:21:10 +08:00
parent 8d226a5f18
commit 2a3eca3be1
3 changed files with 6 additions and 20 deletions

View File

@@ -3,23 +3,6 @@ use benchmark_simple::{Bench, Options};
use sm4_gcm::Sm4GcmStreamEncryptor;
fn main() {
let key = [0u8; 16];
let nonce = [0u8; 12];
let mut e = Sm4GcmStreamEncryptor::new(key, &nonce);
println!("{}", hex::encode(&key));
println!("{}", hex::encode(&nonce));
let a = e.update(b"hello world");
let (b, t) = e.finalize();
let mut enc = a.clone();
enc.extend_from_slice(&b);
enc.extend_from_slice(&t);
println!("{}", hex::encode(&enc));
// ----------------------------------------------------------------------
let bench = Bench::new();
let mut m = vec![0xd0u8; 16384];

0
src/decryptor.rs Normal file
View File

View File

@@ -1,8 +1,11 @@
pub use encryptor::Sm4GcmStreamEncryptor;
pub use crate::encryptor::sm4_gcm_aad_encrypt;
pub use crate::encryptor::sm4_gcm_encrypt;
mod util;
mod encryptor;
pub use encryptor::Sm4GcmStreamEncryptor;
use crate::encryptor::sm4_gcm_aad_encrypt;
mod decryptor;
// Test vectors are all from BC
#[test]