From c61cd0049b91505664e79fe0f5db34c0babbec8a Mon Sep 17 00:00:00 2001 From: Aaron Feickert <66188213+AaronFeickert@users.noreply.github.com> Date: Mon, 21 Nov 2022 09:41:36 +0200 Subject: [PATCH] feat: update tari_utilities and tests (#152) 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](https://github.com/tari-project/tari-crypto/pull/151). --- Cargo.toml | 2 +- src/hashing.rs | 14 ++++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index 9e8d1cfb..9b3eff23 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -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" diff --git a/src/hashing.rs b/src/hashing.rs index e47f33ae..f1f7325c 100644 --- a/src/hashing.rs +++ b/src/hashing.rs @@ -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::::new(); + hasher.update([0, 0, 0]); + + hidden_type!(Key, SafeArray); + 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");