fixes, save results, visualizations

This commit is contained in:
Maciej Lebiest 2024-12-08 16:40:29 +01:00
parent c461f189b6
commit 0611f1c786
21 changed files with 121 additions and 10 deletions

5
3des192_decryption.csv Normal file
View file

@ -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
1 key_size data_size time_ms
2 192 10 0.001
3 192 1000 0.062
4 192 100000 6.207
5 192 10000000 621.734

5
3des192_encryption.csv Normal file
View file

@ -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
1 key_size data_size time_ms
2 192 10 0.002
3 192 1000 0.067
4 192 100000 6.249
5 192 10000000 627.943

View file

@ -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
1 count key_size time_ms
2 1 192 0.001
3 10 192 0.06
4 100 192 0.062
5 1000 192 0.103

5
aes128_decryption.csv Normal file
View file

@ -0,0 +1,5 @@
key_size,data_size,time_ms
128,10,0
128,1000,0
128,100000,0.008
128,10000000,4.272
1 key_size data_size time_ms
2 128 10 0
3 128 1000 0
4 128 100000 0.008
5 128 10000000 4.272

5
aes128_encryption.csv Normal file
View file

@ -0,0 +1,5 @@
key_size,data_size,time_ms
128,10,0
128,1000,0
128,100000,0.068
128,10000000,11.043
1 key_size data_size time_ms
2 128 10 0
3 128 1000 0
4 128 100000 0.068
5 128 10000000 11.043

5
aes192_decryption.csv Normal file
View file

@ -0,0 +1,5 @@
key_size,data_size,time_ms
192,10,0
192,1000,0
192,100000,0.012
192,10000000,3.884
1 key_size data_size time_ms
2 192 10 0
3 192 1000 0
4 192 100000 0.012
5 192 10000000 3.884

5
aes192_encryption.csv Normal file
View file

@ -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
1 key_size data_size time_ms
2 192 10 0
3 192 1000 0.001
4 192 100000 0.082
5 192 10000000 11.771

5
aes256_decryption.csv Normal file
View file

@ -0,0 +1,5 @@
key_size,data_size,time_ms
256,10,0
256,1000,0
256,100000,0.014
256,10000000,4.184
1 key_size data_size time_ms
2 256 10 0
3 256 1000 0
4 256 100000 0.014
5 256 10000000 4.184

5
aes256_encryption.csv Normal file
View file

@ -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
1 key_size data_size time_ms
2 256 10 0.001
3 256 1000 0.001
4 256 100000 0.091
5 256 10000000 11.563

13
aes_keygen_benchmark.csv Normal file
View file

@ -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
1 count key_size time_ms
2 1 128 0
3 1 192 0
4 1 256 0
5 10 128 0.04
6 10 192 0.061
7 10 256 0.08
8 100 128 0.042
9 100 192 0.06
10 100 256 0.08
11 1000 128 0.069
12 1000 192 0.101
13 1000 256 0.134

5
rsa1024_decryption.csv Normal file
View file

@ -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
1 key_size data_size time_ms
2 1024 10 0.233
3 1024 1000 1.974
4 1024 100000 189.815
5 1024 10000000 18984.256

5
rsa1024_encryption.csv Normal file
View file

@ -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
1 key_size data_size time_ms
2 1024 10 0.051
3 1024 1000 0.403
4 1024 100000 37.897
5 1024 10000000 3776.197

5
rsa2048_decryption.csv Normal file
View file

@ -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
1 key_size data_size time_ms
2 2048 10 1.307
3 2048 1000 6.474
4 2048 100000 529.126
5 2048 10000000 52808.375

5
rsa2048_encryption.csv Normal file
View file

@ -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
1 key_size data_size time_ms
2 2048 10 0.165
3 2048 1000 0.784
4 2048 100000 63.955
5 2048 10000000 6372.035

5
rsa3072_decryption.csv Normal file
View file

@ -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
1 key_size data_size time_ms
2 3072 10 3.928
3 3072 1000 11.809
4 3072 100000 1054.251
5 3072 10000000 105256.87

5
rsa3072_encryption.csv Normal file
View file

@ -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
1 key_size data_size time_ms
2 3072 10 0.351
3 3072 1000 1.018
4 3072 100000 90.893
5 3072 10000000 9050.934

5
rsa512_decryption.csv Normal file
View file

@ -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
1 key_size data_size time_ms
2 512 10 0.059
3 512 1000 0.966
4 512 100000 96.361
5 512 10000000 9568.021

5
rsa512_encryption.csv Normal file
View file

@ -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
1 key_size data_size time_ms
2 512 10 0.018
3 512 1000 0.287
4 512 100000 27.48
5 512 10000000 2790.804

13
rsa_keygen_benchmark.csv Normal file
View file

@ -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
1 count key_size time_ms
2 1 512 4.11
3 1 1024 22.783
4 1 2048 128.464
5 10 512 26.444
6 10 1024 153.001
7 10 2048 1658.256
8 100 512 241.216
9 100 1024 1492.256
10 100 2048 15214.671
11 1000 512 2526.931
12 1000 1024 15952.701
13 1000 2048 148078.44

View file

@ -181,7 +181,7 @@ fn measure_aes_performance(
iv: &[u8], iv: &[u8],
sizes: &[usize] sizes: &[usize]
) -> Result<(), Box<dyn Error>> { ) -> Result<(), Box<dyn Error>> {
println!("Measuting aes{} performance", key.len().to_string()); println!("Measuting aes{} performance", (key.len()*8).to_string());
let mut encryption_results = vec![]; let mut encryption_results = vec![];
let mut decryption_results = vec![]; let mut decryption_results = vec![];
@ -210,7 +210,7 @@ fn measure_aes_performance(
let mut wtr = csv::Writer::from_writer(encrypt_file); let mut wtr = csv::Writer::from_writer(encrypt_file);
wtr.write_record(&["key_size", "data_size", "time_ms"])?; wtr.write_record(&["key_size", "data_size", "time_ms"])?;
for (size, time) in encryption_results { 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 // Save decryption results to CSV
@ -218,7 +218,7 @@ fn measure_aes_performance(
let mut wtr = csv::Writer::from_writer(decrypt_file); let mut wtr = csv::Writer::from_writer(decrypt_file);
wtr.write_record(&["key_size", "data_size", "time_ms"])?; wtr.write_record(&["key_size", "data_size", "time_ms"])?;
for (size, time) in decryption_results { 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(()) Ok(())
} }
@ -259,7 +259,7 @@ fn measure_3des_performance(
let mut wtr = csv::Writer::from_writer(encrypt_file); let mut wtr = csv::Writer::from_writer(encrypt_file);
wtr.write_record(&["key_size", "data_size", "time_ms"])?; wtr.write_record(&["key_size", "data_size", "time_ms"])?;
for (size, time) in encryption_results { 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 // Save decryption results to CSV
@ -267,15 +267,15 @@ fn measure_3des_performance(
let mut wtr = csv::Writer::from_writer(decrypt_file); let mut wtr = csv::Writer::from_writer(decrypt_file);
wtr.write_record(&["key_size", "data_size", "time_ms"])?; wtr.write_record(&["key_size", "data_size", "time_ms"])?;
for (size, time) in decryption_results { 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(()) Ok(())
} }
fn test_rsa_key_gen(rng: OsRng) -> Result<(), Box<dyn Error>> { fn test_rsa_key_gen(rng: OsRng) -> Result<(), Box<dyn Error>> {
let counts = [1, 10, 100 ]; let counts = [1, 10, 100, 1000 ];
let key_sizes = [1024, 2048 ]; let key_sizes = [512, 1024, 2048 ];
let file = File::create("rsa_keygen_benchmark.csv")?; let file = File::create("rsa_keygen_benchmark.csv")?;
let mut wtr = csv::Writer::from_writer(file); let mut wtr = csv::Writer::from_writer(file);
@ -304,7 +304,7 @@ fn test_rsa_key_gen(rng: OsRng) -> Result<(), Box<dyn Error>> {
fn test_3des_key_gen(rng: OsRng) -> Result<(), Box<dyn Error>> { fn test_3des_key_gen(rng: OsRng) -> Result<(), Box<dyn Error>> {
let counts = [1, 10, 100, 1000 ]; let counts = [1, 10, 100, 1000 ];
let key_sizes = [112, 168 ]; let key_sizes = [192 ];
let file = File::create("3des_keygen_benchmark.csv")?; let file = File::create("3des_keygen_benchmark.csv")?;
let mut wtr = csv::Writer::from_writer(file); let mut wtr = csv::Writer::from_writer(file);
@ -367,7 +367,7 @@ fn main() {
let _result = test_aes_key_gen(rng); let _result = test_aes_key_gen(rng);
let iv = [0x8; 16]; 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(128, 1, rng)[0], &iv, &data_sizes);
let _result = measure_aes_performance(&generate_aes_keys(192, 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 iv = [0x8; 8];
let _result = measure_3des_performance(&generate_3des_keys(192, 1, rng)[0], &iv, &data_sizes); 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 keys = generate_rsa_keys(1, size, rng);
let (privkey, pubkey) = &keys[0]; let (privkey, pubkey) = &keys[0];
match measure_rsa_performance(&privkey, &pubkey, size, &data_sizes) { match measure_rsa_performance(&privkey, &pubkey, size, &data_sizes) {

BIN
visualize.ods Normal file

Binary file not shown.