Crate sm3[][src]

Expand description

An implementation of the [SM3] cryptographic hash function defined in OSCCA GM/T 0004-2012.

Usage

Hasher functionality is expressed via traits defined in the digest crate.

use hex_literal::hex;
use sm3::{Digest, Sm3};

// create a hasher object, to use it do not forget to import `Digest` trait
let mut hasher = Sm3::new();

// write input message
hasher.update(b"hello world");

// read hash digest and consume hasher
let result = hasher.finalize();

assert_eq!(result[..], hex!("
    44f0061e69fa6fdfc290c494654a05dc0c053da7e5c52b84ef93a9d67d3fff88
")[..]);

Also see RustCrypto/hashes readme.

Re-exports

pub use digest;

Structs

The SM3 hash algorithm with the SM3 initial hash value.

Traits

The Digest trait specifies an interface common for digest functions.