Skip to content

Commit bfa812f

Browse files
tomusdrwdarkfriend77
authored andcommitted
Add keccak-512 to host functions. (paritytech#7531)
1 parent fc03110 commit bfa812f

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

primitives/core/src/hashing.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,11 @@
1616
// limitations under the License.
1717

1818
//! Hashing functions.
19+
//!
20+
//! This module is gated by `full-crypto` feature. If you intend to use any of the functions
21+
//! defined here within your runtime, you should most likely rather use [sp_io::hashing] instead,
22+
//! unless you know what you're doing. Using `sp_io` will be more performant, since instead of
23+
//! computing the hash in WASM it delegates that computation to the host client.
1924
2025
use blake2_rfc;
2126
use sha2::{Digest, Sha256};

primitives/io/src/lib.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -735,6 +735,11 @@ pub trait Hashing {
735735
sp_core::hashing::keccak_256(data)
736736
}
737737

738+
/// Conduct a 512-bit Keccak hash.
739+
fn keccak_512(data: &[u8]) -> [u8; 64] {
740+
sp_core::hashing::keccak_512(data)
741+
}
742+
738743
/// Conduct a 256-bit Sha2 hash.
739744
fn sha2_256(data: &[u8]) -> [u8; 32] {
740745
sp_core::hashing::sha2_256(data)

0 commit comments

Comments
 (0)