Skip to content

Commit

Permalink
feat: update tari_utilities and tests (#152)
Browse files Browse the repository at this point in the history
Updates the `tari_utilities` dependency to support the new hidden type API. Adds a test that the new `SafeArray` type plays nicely with the hashing API.

Supersedes [PR 151](#151).
  • Loading branch information
AaronFeickert authored Nov 21, 2022
1 parent fa042e4 commit c61cd00
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ version = "0.16.1"
edition = "2018"

[dependencies]
tari_utilities = { git = "https://github.com/tari-project/tari_utilities.git", tag="v0.4.7" }
tari_utilities = { git = "https://github.com/tari-project/tari_utilities.git", tag="v0.4.9" }

base64 = "0.10.1"
blake2 = "0.9.1"
Expand Down
14 changes: 14 additions & 0 deletions src/hashing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -662,6 +662,20 @@ mod test {
hasher.finalize_into_reset(&mut output);
}

#[test]
fn test_safe_array() {
use tari_utilities::{hidden::Hidden, hidden_type, safe_array::SafeArray};
use zeroize::Zeroize;

hash_domain!(TestHasher, "com.example.test");
let mut hasher = DomainSeparatedHasher::<Blake256, TestHasher>::new();
hasher.update([0, 0, 0]);

hidden_type!(Key, SafeArray<u8, 32>);
let mut key = Key::from(SafeArray::default()); // all zeroes
hasher.finalize_into_reset(GenericArray::from_mut_slice(key.reveal_mut()));
}

#[test]
fn dst_hasher() {
hash_domain!(GenericHashDomain, "com.tari.generic");
Expand Down

0 comments on commit c61cd00

Please sign in to comment.