Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Commit

Permalink
Add keccak512 hash (#7428)
Browse files Browse the repository at this point in the history
* Add keccak512

* Update hashing.rs
  • Loading branch information
drewstone authored Oct 26, 2020
1 parent 9fdb708 commit 510e68b
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions primitives/core/src/hashing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,15 @@ pub fn keccak_256(data: &[u8]) -> [u8; 32] {
output
}

/// Do a keccak 512-bit hash and return result.
pub fn keccak_512(data: &[u8]) -> [u8; 64] {
let mut keccak = Keccak::v512();
keccak.update(data);
let mut output = [0u8; 64];
keccak.finalize(&mut output);
output
}

/// Do a sha2 256-bit hash and return result.
pub fn sha2_256(data: &[u8]) -> [u8; 32] {
let mut hasher = Sha256::new();
Expand Down

0 comments on commit 510e68b

Please sign in to comment.