shadow_crypt_core/
report.rs

1use std::time::Duration;
2
3use crate::{algorithm::Algorithm, v1::key::KeyDerivationParams};
4
5pub struct EncryptionReport {
6    pub input_filename: String,
7    pub output_filename: String,
8    pub duration: Duration,
9    pub algorithm: Algorithm,
10}
11impl EncryptionReport {
12    pub fn new(
13        input_filename: String,
14        output_filename: String,
15        duration: Duration,
16        algorithm: Algorithm,
17    ) -> Self {
18        Self {
19            input_filename,
20            output_filename,
21            duration,
22            algorithm,
23        }
24    }
25}
26
27pub struct DecryptionReport {
28    pub input_filename: String,
29    pub output_filename: String,
30    pub duration: Duration,
31    pub algorithm: Algorithm,
32}
33impl DecryptionReport {
34    pub fn new(
35        input_filename: String,
36        output_filename: String,
37        duration: Duration,
38        algorithm: Algorithm,
39    ) -> Self {
40        Self {
41            input_filename,
42            output_filename,
43            duration,
44            algorithm,
45        }
46    }
47}
48
49#[derive(Debug)]
50pub struct KeyDerivationReport {
51    pub algorithm: String,
52    pub algorithm_version: String,
53    pub memory_cost_kib: u32,
54    pub time_cost_iterations: u32,
55    pub parallelism: u32,
56    pub key_size_bytes: u8,
57    pub duration: std::time::Duration,
58}
59impl KeyDerivationReport {
60    pub fn new(
61        algorithm: String,
62        algorithm_version: String,
63        params: &KeyDerivationParams,
64        duration: std::time::Duration,
65    ) -> Self {
66        Self {
67            algorithm,
68            algorithm_version,
69            memory_cost_kib: params.memory_cost,
70            time_cost_iterations: params.time_cost,
71            parallelism: params.parallelism,
72            key_size_bytes: params.key_size,
73            duration,
74        }
75    }
76}