From 693d635f8c3d863408bee518480b1b9d01f67d9a Mon Sep 17 00:00:00 2001 From: Paul Hauner Date: Wed, 19 Sep 2018 14:45:03 +1000 Subject: [PATCH] Add canonical hash function --- lighthouse/utils/hash.rs | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 lighthouse/utils/hash.rs diff --git a/lighthouse/utils/hash.rs b/lighthouse/utils/hash.rs new file mode 100644 index 000000000..7b52eb9d1 --- /dev/null +++ b/lighthouse/utils/hash.rs @@ -0,0 +1,6 @@ +use super::blake2::blake2b::blake2b; + +pub fn canonical_hash(input: &[u8]) -> Vec { + let result = blake2b(64, &[], input); + result.as_bytes()[0..32].to_vec() +}