Skip to main content

shadow_crypt_core/
report.rs

1use std::time::Duration;
2
3use crate::algorithm::Algorithm;
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    /// Takes raw parameter values so the report stays independent of any
61    /// version-specific `KeyDerivationParams` type.
62    pub fn new(
63        algorithm: String,
64        algorithm_version: String,
65        memory_cost_kib: u32,
66        time_cost_iterations: u32,
67        parallelism: u32,
68        key_size_bytes: u8,
69        duration: std::time::Duration,
70    ) -> Self {
71        Self {
72            algorithm,
73            algorithm_version,
74            memory_cost_kib,
75            time_cost_iterations,
76            parallelism,
77            key_size_bytes,
78            duration,
79        }
80    }
81}