Add create commit
This commit is contained in:
parent
fcdfeeaecc
commit
e26ea1068d
@ -574,3 +574,11 @@ pub fn try_decrypt_with_key(
|
||||
let plain = String::from_utf8(aes_dec.decrypt_with_key()?)?;
|
||||
Ok(plain)
|
||||
}
|
||||
|
||||
#[wasm_bindgen]
|
||||
pub fn create_commitment(payload_to_hash: String) -> String{
|
||||
let mut engine = sha256::HashEngine::default();
|
||||
engine.write_all(&payload_to_hash.as_bytes());
|
||||
let hash = sha256::Hash::from_engine(engine);
|
||||
String::from_utf8_lossy(hash.to_bytes())
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user