]> git.proxmox.com Git - proxmox-backup.git/commitdiff
fingerprint: add new() method
authorDietmar Maurer <dietmar@proxmox.com>
Wed, 25 Nov 2020 06:56:37 +0000 (07:56 +0100)
committerDietmar Maurer <dietmar@proxmox.com>
Wed, 25 Nov 2020 06:57:39 +0000 (07:57 +0100)
src/backup/crypt_config.rs

index 67482a75e1f7965a11267026e1fdd628da02258f..711f90f6941d64366739dc60b8f0bae6654c9ef1 100644 (file)
@@ -48,6 +48,9 @@ pub struct Fingerprint {
 }
 
 impl Fingerprint {
+    pub fn new(bytes: [u8; 32]) -> Self {
+        Self { bytes }
+    }
     pub fn bytes(&self) -> &[u8; 32] {
         &self.bytes
     }
@@ -132,9 +135,7 @@ impl CryptConfig {
     }
 
     pub fn fingerprint(&self) -> Fingerprint {
-        Fingerprint {
-            bytes: self.compute_digest(&FINGERPRINT_INPUT)
-        }
+        Fingerprint::new(self.compute_digest(&FINGERPRINT_INPUT))
     }
 
     pub fn data_crypter(&self, iv: &[u8; 16], mode: Mode) -> Result<Crypter, Error>  {