use rsa::{RsaPrivateKey, RsaPublicKey}; use std::time::Instant; use rand::rngs::OsRng; fn generate_rsa_keys(count: usize, key_size: usize) -> Vec<(RsaPrivateKey, RsaPublicKey)> { let mut rng = OsRng; (0..count) .map(|_| { let private_key = RsaPrivateKey::new(&mut rng, key_size).expect("Failed to generate a key"); let public_key = RsaPublicKey::from(&private_key); (private_key, public_key) }) .collect() } fn main() { let start = Instant::now(); generate_rsa_keys(10, 2048); let duration = start.elapsed(); println!("Execution time: {:?}", duration); }