mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-26 11:07:56 +00:00
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:
@@ -10,7 +10,7 @@ use rstd::{vec::Vec, vec};
|
||||
|
||||
#[cfg(not(feature = "std"))]
|
||||
use runtime_io::{
|
||||
storage, hashing::{blake2_128, blake2_256, twox_128, twox_256},
|
||||
storage, hashing::{blake2_128, blake2_256, sha2_256, twox_128, twox_256},
|
||||
crypto::{ed25519_verify, sr25519_verify},
|
||||
};
|
||||
#[cfg(not(feature = "std"))]
|
||||
@@ -60,6 +60,10 @@ primitives::wasm_export_functions! {
|
||||
blake2_128(&input).to_vec()
|
||||
}
|
||||
|
||||
fn test_sha2_256(input: Vec<u8>) -> Vec<u8> {
|
||||
sha2_256(&input).to_vec()
|
||||
}
|
||||
|
||||
fn test_twox_256(input: Vec<u8>) -> Vec<u8> {
|
||||
twox_256(&input).to_vec()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user