SM3 is a hash function. To use SM3 in libsm:
-
Make sure that your data is
&[u8]
. -
Create a
SM3Hash
. -
Get the digest.
Sample:
use libsm::sm3::Sm3Hash;
let string = String::from("sample");
let mut hash = Sm3Hash::new(string.as_bytes());
let digest: [u8;32] = hash.get_hash();