aboutsummaryrefslogtreecommitdiff
path: root/src/test.rs
diff options
context:
space:
mode:
authorJack O'Connor <[email protected]>2021-02-28 18:05:20 -0500
committerJack O'Connor <[email protected]>2021-02-28 18:10:59 -0500
commit71d67e081028972790d4b56e23dc57805aa78a85 (patch)
tree9bea3d32b329f1beedaebc388825a405bd0c5ccd /src/test.rs
parent134bb24686f9a1cd02ad12fdf22a72d9c1071220 (diff)
make derive_key() return an array
Diffstat (limited to 'src/test.rs')
-rw-r--r--src/test.rs18
1 files changed, 8 insertions, 10 deletions
diff --git a/src/test.rs b/src/test.rs
index cd46091..7e9fd42 100644
--- a/src/test.rs
+++ b/src/test.rs
@@ -284,7 +284,7 @@ fn test_compare_reference_impl() {
// all at once
let test_out = crate::hash(input);
- assert_eq!(test_out, *array_ref!(expected_out, 0, 32));
+ assert_eq!(test_out, expected_out[..32]);
// incremental
let mut hasher = crate::Hasher::new();
hasher.update(input);
@@ -293,7 +293,7 @@ fn test_compare_reference_impl() {
// xof
let mut extended = [0; OUT];
hasher.finalize_xof().fill(&mut extended);
- assert_eq!(extended[..], expected_out[..]);
+ assert_eq!(extended, expected_out);
}
// keyed
@@ -305,7 +305,7 @@ fn test_compare_reference_impl() {
// all at once
let test_out = crate::keyed_hash(&TEST_KEY, input);
- assert_eq!(test_out, *array_ref!(expected_out, 0, 32));
+ assert_eq!(test_out, expected_out[..32]);
// incremental
let mut hasher = crate::Hasher::new_keyed(&TEST_KEY);
hasher.update(input);
@@ -314,7 +314,7 @@ fn test_compare_reference_impl() {
// xof
let mut extended = [0; OUT];
hasher.finalize_xof().fill(&mut extended);
- assert_eq!(extended[..], expected_out[..]);
+ assert_eq!(extended, expected_out);
}
// derive_key
@@ -326,9 +326,8 @@ fn test_compare_reference_impl() {
reference_hasher.finalize(&mut expected_out);
// all at once
- let mut test_out = [0; OUT];
- crate::derive_key(context, input, &mut test_out);
- assert_eq!(test_out[..], expected_out[..]);
+ let test_out = crate::derive_key(context, input);
+ assert_eq!(test_out[..], expected_out[..32]);
// incremental
let mut hasher = crate::Hasher::new_derive_key(context);
hasher.update(input);
@@ -337,7 +336,7 @@ fn test_compare_reference_impl() {
// xof
let mut extended = [0; OUT];
hasher.finalize_xof().fill(&mut extended);
- assert_eq!(extended[..], expected_out[..]);
+ assert_eq!(extended, expected_out);
}
}
}
@@ -501,8 +500,7 @@ fn test_reset() {
kdf.update(&[42; 3 * CHUNK_LEN + 7]);
kdf.reset();
kdf.update(&[42; CHUNK_LEN + 3]);
- let mut expected = [0; crate::OUT_LEN];
- crate::derive_key(context, &[42; CHUNK_LEN + 3], &mut expected);
+ let expected = crate::derive_key(context, &[42; CHUNK_LEN + 3]);
assert_eq!(kdf.finalize(), expected);
}