feat: v0.2.0-alpha-1, performance improved from 36MB/s to ~450MB/s

This commit is contained in:
2023-08-31 00:20:23 +08:00
parent f4b5f68cd9
commit adb0383133
6 changed files with 180 additions and 13 deletions

View File

@@ -17,11 +17,14 @@ pub use decryptor::Aes256GcmStreamDecryptor;
pub use encryptor::Aes128GcmStreamEncryptor;
pub use encryptor::Aes192GcmStreamEncryptor;
pub use encryptor::Aes256GcmStreamEncryptor;
pub use encryptor2::Aes256GcmStreamEncryptor2;
mod util;
mod encryptor;
mod decryptor;
mod encryptor2;
#[test]
fn test128() {
use aes_gcm::{aead::{Aead, Nonce, Payload}, Aes128Gcm, KeyInit};
@@ -198,6 +201,7 @@ fn test256() {
];
for (key, nonce, aad, plaintext) in knp {
println!("======= {} {} {} {}", hex::encode(key), hex::encode(nonce), hex::encode(aad), hex::encode(plaintext));
// encrypt
let mut ciphertext = vec![];
let mut encryptor = Aes256GcmStreamEncryptor::new(key.clone(), &nonce);