summaryrefslogtreecommitdiff
path: root/src/cipher.rs
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2021-09-18 15:03:15 +0000
committerLars Wirzenius <liw@liw.fi>2021-09-18 15:03:15 +0000
commit7f3f30b0e4b7713d0a6106babf662127ac457210 (patch)
tree9bb7ec9420c2bbd6e3fb9103ee298c445746d3d7 /src/cipher.rs
parentd6728974b98a821b8d633197abd97cf2fc9357f5 (diff)
parent97b9327ac7f73b3a2629cd90da20d1655bf9478e (diff)
downloadobnam2-7f3f30b0e4b7713d0a6106babf662127ac457210.tar.gz
Merge branch 'checksum-type' into 'main'
refactor: define a Checksum type and use it where appropriate Closes #136 See merge request obnam/obnam!180
Diffstat (limited to 'src/cipher.rs')
-rw-r--r--src/cipher.rs7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/cipher.rs b/src/cipher.rs
index b8e02f2..04b2944 100644
--- a/src/cipher.rs
+++ b/src/cipher.rs
@@ -164,6 +164,7 @@ impl Nonce {
#[cfg(test)]
mod test {
+ use crate::checksummer::Checksum;
use crate::chunk::DataChunk;
use crate::chunkmeta::ChunkMeta;
use crate::cipher::{CipherEngine, CipherError, CHUNK_V1, NONCE_SIZE};
@@ -171,7 +172,8 @@ mod test {
#[test]
fn metadata_as_aad() {
- let meta = ChunkMeta::new("dummy-checksum");
+ let sum = Checksum::sha256_from_str_unchecked("dummy-checksum");
+ let meta = ChunkMeta::new(&sum);
let meta_as_aad = meta.to_json_vec();
let chunk = DataChunk::new("hello".as_bytes().to_vec(), meta);
let pass = Passwords::new("secret");
@@ -183,7 +185,8 @@ mod test {
#[test]
fn round_trip() {
- let meta = ChunkMeta::new("dummy-checksum");
+ let sum = Checksum::sha256_from_str_unchecked("dummy-checksum");
+ let meta = ChunkMeta::new(&sum);
let chunk = DataChunk::new("hello".as_bytes().to_vec(), meta);
let pass = Passwords::new("secret");