fingerprint: add new() method

This commit is contained in:
Dietmar Maurer 2020-11-25 07:56:37 +01:00
parent af9f72e9d8
commit a303e00289

View File

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