aboutsummaryrefslogtreecommitdiff
path: root/test_vectors
diff options
context:
space:
mode:
authorJack O'Connor <[email protected]>2021-11-04 20:37:05 -0400
committerJack O'Connor <[email protected]>2021-11-04 20:37:05 -0400
commit04571021fb5490d0f0008c5b5a968f221de159a0 (patch)
treef9189343dd9f684b32758b2f989d29d4bc4552d4 /test_vectors
parent1042917e1625be7daf237a8ccfeba824eac68a89 (diff)
add Hasher::count
Diffstat (limited to 'test_vectors')
-rw-r--r--test_vectors/src/lib.rs15
1 files changed, 9 insertions, 6 deletions
diff --git a/test_vectors/src/lib.rs b/test_vectors/src/lib.rs
index ec769d1..eea5528 100644
--- a/test_vectors/src/lib.rs
+++ b/test_vectors/src/lib.rs
@@ -240,8 +240,9 @@ mod tests {
) {
let mut out = vec![0; expected_hash.len()];
let mut hasher = blake3::Hasher::new();
- for &b in input {
- hasher.update(&[b]);
+ for i in 0..input.len() {
+ hasher.update(&[input[i]]);
+ assert_eq!(i as u64 + 1, hasher.count());
}
hasher.finalize_xof().fill(&mut out);
assert_eq!(expected_hash, &out[..]);
@@ -249,8 +250,9 @@ mod tests {
let mut out = vec![0; expected_keyed_hash.len()];
let mut hasher = blake3::Hasher::new_keyed(key);
- for &b in input {
- hasher.update(&[b]);
+ for i in 0..input.len() {
+ hasher.update(&[input[i]]);
+ assert_eq!(i as u64 + 1, hasher.count());
}
hasher.finalize_xof().fill(&mut out);
assert_eq!(expected_keyed_hash, &out[..]);
@@ -258,8 +260,9 @@ mod tests {
let mut out = vec![0; expected_derive_key.len()];
let mut hasher = blake3::Hasher::new_derive_key(TEST_CONTEXT);
- for &b in input {
- hasher.update(&[b]);
+ for i in 0..input.len() {
+ hasher.update(&[input[i]]);
+ assert_eq!(i as u64 + 1, hasher.count());
}
hasher.finalize_xof().fill(&mut out);
assert_eq!(expected_derive_key, &out[..]);