ciphern 0.2.1

Enterprise-grade cryptographic library
Documentation
// Copyright (c) 2025 Kirky.X
//
// Licensed under the MIT License
// See LICENSE file in the project root for full license information.

#[test]
fn uat_simd_performance_check() {
    use ciphern::provider::registry::REGISTRY;
    use ciphern::{Algorithm, KeyManager};
    use std::time::Instant;

    let key_manager = KeyManager::new().unwrap();
    let key_id = key_manager.generate_key(Algorithm::AES256GCM).unwrap();
    let cipher = REGISTRY.get_symmetric(Algorithm::AES256GCM).unwrap();
    let key = key_manager.get_key(&key_id).unwrap();

    let size = 1024 * 1024; // 1MB
    let plaintext = vec![0u8; size];

    // Warmup
    for _ in 0..10 {
        let _ = cipher.encrypt(&key, &plaintext, None).unwrap();
    }

    let iterations = 100;
    let start = Instant::now();
    for _ in 0..iterations {
        let _ = cipher.encrypt(&key, &plaintext, None).unwrap();
    }
    let elapsed = start.elapsed();

    let total_bytes = (size * iterations) as f64;
    let seconds = elapsed.as_secs_f64();
    let throughput_mb_s = (total_bytes / seconds) / (1024.0 * 1024.0);

    println!("AES-256-GCM Throughput: {:.2} MB/s", throughput_mb_s);

    // Basic sanity check for performance
    // assert!(throughput_mb_s > 100.0);
}