Add sha2-256 hash function (#4218)

* Add sha2-256 hash function

Widely used hash function, supported by bitcoin and ethereum

* Add runtime io support

* add test

* add test

* Update hashing.rs

* Update hashing.rs
This commit is contained in:
Weiliang Li
2019-11-28 02:32:35 +09:00
committed by Gavin Wood
parent f8bf17dc49
commit dcaabbaacf
4 changed files with 57 additions and 2 deletions
+5
View File
@@ -384,6 +384,11 @@ pub trait Hashing {
primitives::hashing::keccak_256(data)
}
/// Conduct a 256-bit Sha2 hash.
fn sha2_256(data: &[u8]) -> [u8; 32] {
primitives::hashing::sha2_256(data)
}
/// Conduct a 128-bit Blake2 hash.
fn blake2_128(data: &[u8]) -> [u8; 16] {
primitives::hashing::blake2_128(data)