diff --git a/3des192_decryption.csv b/3des192_decryption.csv new file mode 100644 index 0000000..359cb50 --- /dev/null +++ b/3des192_decryption.csv @@ -0,0 +1,5 @@ +key_size,data_size,time_ms +192,10,0.001 +192,1000,0.062 +192,100000,6.207 +192,10000000,621.734 diff --git a/3des192_encryption.csv b/3des192_encryption.csv new file mode 100644 index 0000000..2eb9ad5 --- /dev/null +++ b/3des192_encryption.csv @@ -0,0 +1,5 @@ +key_size,data_size,time_ms +192,10,0.002 +192,1000,0.067 +192,100000,6.249 +192,10000000,627.943 diff --git a/3des_keygen_benchmark.csv b/3des_keygen_benchmark.csv new file mode 100644 index 0000000..cbfeb7a --- /dev/null +++ b/3des_keygen_benchmark.csv @@ -0,0 +1,5 @@ +count,key_size,time_ms +1,192,0.001 +10,192,0.06 +100,192,0.062 +1000,192,0.103 diff --git a/aes128_decryption.csv b/aes128_decryption.csv new file mode 100644 index 0000000..2156961 --- /dev/null +++ b/aes128_decryption.csv @@ -0,0 +1,5 @@ +key_size,data_size,time_ms +128,10,0 +128,1000,0 +128,100000,0.008 +128,10000000,4.272 diff --git a/aes128_encryption.csv b/aes128_encryption.csv new file mode 100644 index 0000000..c6d8dba --- /dev/null +++ b/aes128_encryption.csv @@ -0,0 +1,5 @@ +key_size,data_size,time_ms +128,10,0 +128,1000,0 +128,100000,0.068 +128,10000000,11.043 diff --git a/aes192_decryption.csv b/aes192_decryption.csv new file mode 100644 index 0000000..36b90fa --- /dev/null +++ b/aes192_decryption.csv @@ -0,0 +1,5 @@ +key_size,data_size,time_ms +192,10,0 +192,1000,0 +192,100000,0.012 +192,10000000,3.884 diff --git a/aes192_encryption.csv b/aes192_encryption.csv new file mode 100644 index 0000000..f2bd018 --- /dev/null +++ b/aes192_encryption.csv @@ -0,0 +1,5 @@ +key_size,data_size,time_ms +192,10,0 +192,1000,0.001 +192,100000,0.082 +192,10000000,11.771 diff --git a/aes256_decryption.csv b/aes256_decryption.csv new file mode 100644 index 0000000..039bc3f --- /dev/null +++ b/aes256_decryption.csv @@ -0,0 +1,5 @@ +key_size,data_size,time_ms +256,10,0 +256,1000,0 +256,100000,0.014 +256,10000000,4.184 diff --git a/aes256_encryption.csv b/aes256_encryption.csv new file mode 100644 index 0000000..94a3c71 --- /dev/null +++ b/aes256_encryption.csv @@ -0,0 +1,5 @@ +key_size,data_size,time_ms +256,10,0.001 +256,1000,0.001 +256,100000,0.091 +256,10000000,11.563 diff --git a/aes_keygen_benchmark.csv b/aes_keygen_benchmark.csv new file mode 100644 index 0000000..9921427 --- /dev/null +++ b/aes_keygen_benchmark.csv @@ -0,0 +1,13 @@ +count,key_size,time_ms +1,128,0 +1,192,0 +1,256,0 +10,128,0.04 +10,192,0.061 +10,256,0.08 +100,128,0.042 +100,192,0.06 +100,256,0.08 +1000,128,0.069 +1000,192,0.101 +1000,256,0.134 diff --git a/rsa1024_decryption.csv b/rsa1024_decryption.csv new file mode 100644 index 0000000..c2ad8f4 --- /dev/null +++ b/rsa1024_decryption.csv @@ -0,0 +1,5 @@ +key_size,data_size,time_ms +1024,10,0.233 +1024,1000,1.974 +1024,100000,189.815 +1024,10000000,18984.256 diff --git a/rsa1024_encryption.csv b/rsa1024_encryption.csv new file mode 100644 index 0000000..dbfb0cd --- /dev/null +++ b/rsa1024_encryption.csv @@ -0,0 +1,5 @@ +key_size,data_size,time_ms +1024,10,0.051 +1024,1000,0.403 +1024,100000,37.897 +1024,10000000,3776.197 diff --git a/rsa2048_decryption.csv b/rsa2048_decryption.csv new file mode 100644 index 0000000..c2cf44e --- /dev/null +++ b/rsa2048_decryption.csv @@ -0,0 +1,5 @@ +key_size,data_size,time_ms +2048,10,1.307 +2048,1000,6.474 +2048,100000,529.126 +2048,10000000,52808.375 diff --git a/rsa2048_encryption.csv b/rsa2048_encryption.csv new file mode 100644 index 0000000..dacaf1f --- /dev/null +++ b/rsa2048_encryption.csv @@ -0,0 +1,5 @@ +key_size,data_size,time_ms +2048,10,0.165 +2048,1000,0.784 +2048,100000,63.955 +2048,10000000,6372.035 diff --git a/rsa3072_decryption.csv b/rsa3072_decryption.csv new file mode 100644 index 0000000..c72a4d3 --- /dev/null +++ b/rsa3072_decryption.csv @@ -0,0 +1,5 @@ +key_size,data_size,time_ms +3072,10,3.928 +3072,1000,11.809 +3072,100000,1054.251 +3072,10000000,105256.87 diff --git a/rsa3072_encryption.csv b/rsa3072_encryption.csv new file mode 100644 index 0000000..aaf04ed --- /dev/null +++ b/rsa3072_encryption.csv @@ -0,0 +1,5 @@ +key_size,data_size,time_ms +3072,10,0.351 +3072,1000,1.018 +3072,100000,90.893 +3072,10000000,9050.934 diff --git a/rsa512_decryption.csv b/rsa512_decryption.csv new file mode 100644 index 0000000..544e941 --- /dev/null +++ b/rsa512_decryption.csv @@ -0,0 +1,5 @@ +key_size,data_size,time_ms +512,10,0.059 +512,1000,0.966 +512,100000,96.361 +512,10000000,9568.021 diff --git a/rsa512_encryption.csv b/rsa512_encryption.csv new file mode 100644 index 0000000..8ec2a2a --- /dev/null +++ b/rsa512_encryption.csv @@ -0,0 +1,5 @@ +key_size,data_size,time_ms +512,10,0.018 +512,1000,0.287 +512,100000,27.48 +512,10000000,2790.804 diff --git a/rsa_keygen_benchmark.csv b/rsa_keygen_benchmark.csv new file mode 100644 index 0000000..6810114 --- /dev/null +++ b/rsa_keygen_benchmark.csv @@ -0,0 +1,13 @@ +count,key_size,time_ms +1,512,4.11 +1,1024,22.783 +1,2048,128.464 +10,512,26.444 +10,1024,153.001 +10,2048,1658.256 +100,512,241.216 +100,1024,1492.256 +100,2048,15214.671 +1000,512,2526.931 +1000,1024,15952.701 +1000,2048,148078.44 diff --git a/src/main.rs b/src/main.rs index 68fcde2..3f40a5b 100644 --- a/src/main.rs +++ b/src/main.rs @@ -181,7 +181,7 @@ fn measure_aes_performance( iv: &[u8], sizes: &[usize] ) -> Result<(), Box> { - println!("Measuting aes{} performance", key.len().to_string()); + println!("Measuting aes{} performance", (key.len()*8).to_string()); let mut encryption_results = vec![]; let mut decryption_results = vec![]; @@ -210,7 +210,7 @@ fn measure_aes_performance( let mut wtr = csv::Writer::from_writer(encrypt_file); wtr.write_record(&["key_size", "data_size", "time_ms"])?; for (size, time) in encryption_results { - wtr.write_record(&[key.len().to_string(), size.to_string(), time.to_string()])?; + wtr.write_record(&[(key.len()*8).to_string(), size.to_string(), time.to_string()])?; } // Save decryption results to CSV @@ -218,7 +218,7 @@ fn measure_aes_performance( let mut wtr = csv::Writer::from_writer(decrypt_file); wtr.write_record(&["key_size", "data_size", "time_ms"])?; for (size, time) in decryption_results { - wtr.write_record(&[key.len().to_string(), size.to_string(), time.to_string()])?; + wtr.write_record(&[(key.len()*8).to_string(), size.to_string(), time.to_string()])?; } Ok(()) } @@ -259,7 +259,7 @@ fn measure_3des_performance( let mut wtr = csv::Writer::from_writer(encrypt_file); wtr.write_record(&["key_size", "data_size", "time_ms"])?; for (size, time) in encryption_results { - wtr.write_record(&[key.len().to_string(), size.to_string(), time.to_string()])?; + wtr.write_record(&[(key.len()*8).to_string(), size.to_string(), time.to_string()])?; } // Save decryption results to CSV @@ -267,15 +267,15 @@ fn measure_3des_performance( let mut wtr = csv::Writer::from_writer(decrypt_file); wtr.write_record(&["key_size", "data_size", "time_ms"])?; for (size, time) in decryption_results { - wtr.write_record(&[key.len().to_string(), size.to_string(), time.to_string()])?; + wtr.write_record(&[(key.len()*8).to_string(), size.to_string(), time.to_string()])?; } Ok(()) } fn test_rsa_key_gen(rng: OsRng) -> Result<(), Box> { - let counts = [1, 10, 100 ]; - let key_sizes = [1024, 2048 ]; + let counts = [1, 10, 100, 1000 ]; + let key_sizes = [512, 1024, 2048 ]; let file = File::create("rsa_keygen_benchmark.csv")?; let mut wtr = csv::Writer::from_writer(file); @@ -304,7 +304,7 @@ fn test_rsa_key_gen(rng: OsRng) -> Result<(), Box> { fn test_3des_key_gen(rng: OsRng) -> Result<(), Box> { let counts = [1, 10, 100, 1000 ]; - let key_sizes = [112, 168 ]; + let key_sizes = [192 ]; let file = File::create("3des_keygen_benchmark.csv")?; let mut wtr = csv::Writer::from_writer(file); @@ -367,7 +367,7 @@ fn main() { let _result = test_aes_key_gen(rng); let iv = [0x8; 16]; - let data_sizes = [10, 1000, 10000, 100000 ]; + let data_sizes = [10, 1000, 100000, 10000000 ]; let _result = measure_aes_performance(&generate_aes_keys(128, 1, rng)[0], &iv, &data_sizes); let _result = measure_aes_performance(&generate_aes_keys(192, 1, rng)[0], &iv, &data_sizes); @@ -376,7 +376,7 @@ fn main() { let iv = [0x8; 8]; let _result = measure_3des_performance(&generate_3des_keys(192, 1, rng)[0], &iv, &data_sizes); - for size in [512, 1024, 2048] { + for size in [512, 1024, 2048, 3072] { let keys = generate_rsa_keys(1, size, rng); let (privkey, pubkey) = &keys[0]; match measure_rsa_performance(&privkey, &pubkey, size, &data_sizes) { diff --git a/visualize.ods b/visualize.ods new file mode 100644 index 0000000..888ea22 Binary files /dev/null and b/visualize.ods differ