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 authored and Gavin Wood committed 2019-11-27 17:32:35 +00:00
1 parent f8bf17dc49
commit dcaabbaacf
4 files changed
+57 -2

No files matched your search

+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)