diff options
author | Lars Wirzenius <liw@liw.fi> | 2022-04-09 11:27:14 +0300 |
---|---|---|
committer | Lars Wirzenius <liw@liw.fi> | 2022-04-16 09:04:28 +0300 |
commit | d9b72ffa5485f3c253da22f09ff0a7090de7aa37 (patch) | |
tree | ffcfc0d0b2377c95072b609095589fbf83424382 /src/cipher.rs | |
parent | 9f6ff22ff9a1b0a5a28d037846b1cecee4f2945c (diff) | |
download | obnam2-d9b72ffa5485f3c253da22f09ff0a7090de7aa37.tar.gz |
refactor: rename Checksum to Label
Label is a clearer and more accurate name for the type now that it is
not just a checksum.
Also, serialize a Label in tests, rather than using string literals.
This is more correct, and we'll be changing serialization later.
Sponsored-by: author
Diffstat (limited to 'src/cipher.rs')
-rw-r--r-- | src/cipher.rs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/cipher.rs b/src/cipher.rs index ee7fb8f..7bd2e84 100644 --- a/src/cipher.rs +++ b/src/cipher.rs @@ -191,15 +191,15 @@ 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}; + use crate::label::Label; use crate::passwords::Passwords; #[test] fn metadata_as_aad() { - let sum = Checksum::sha256_from_str_unchecked("dummy-checksum"); + let sum = Label::sha256(b"dummy data"); let meta = ChunkMeta::new(&sum); let meta_as_aad = meta.to_json_vec(); let chunk = DataChunk::new("hello".as_bytes().to_vec(), meta); @@ -212,7 +212,7 @@ mod test { #[test] fn round_trip() { - let sum = Checksum::sha256_from_str_unchecked("dummy-checksum"); + let sum = Label::sha256(b"dummy data"); let meta = ChunkMeta::new(&sum); let chunk = DataChunk::new("hello".as_bytes().to_vec(), meta); let pass = Passwords::new("secret"); |