Add wasm bindings for Hash

(cherry picked from commit 03a956e8d9)
This commit is contained in:
Michael Vines
2021-10-18 22:01:39 -07:00
parent 8836069719
commit effd0b2547
4 changed files with 149 additions and 3 deletions

View File

@@ -1,7 +1,7 @@
//! The `hash` module provides functions for creating SHA-256 hashes.
use {
crate::sanitize::Sanitize,
crate::{sanitize::Sanitize, wasm_bindgen},
borsh::{BorshDeserialize, BorshSchema, BorshSerialize},
sha2::{Digest, Sha256},
std::{convert::TryFrom, fmt, mem, str::FromStr},
@@ -11,6 +11,8 @@ use {
pub const HASH_BYTES: usize = 32;
/// Maximum string length of a base58 encoded hash
const MAX_BASE58_LEN: usize = 44;
#[wasm_bindgen]
#[derive(
Serialize,
Deserialize,