#hash #digest #crypto

no-std sm3

SM3 (OSCCA GM/T 0004-2012) hash function

10 releases

0.5.0-pre.3 Feb 1, 2024
0.5.0-pre.2 Jan 17, 2024
0.4.2 May 16, 2023
0.4.1 Feb 17, 2022
0.1.0 Jan 14, 2020

#2486 in Cryptography

Download history 3521/week @ 2024-02-15 5523/week @ 2024-02-22 4011/week @ 2024-02-29 5428/week @ 2024-03-07 4973/week @ 2024-03-14 5331/week @ 2024-03-21 5710/week @ 2024-03-28 4291/week @ 2024-04-04 5173/week @ 2024-04-11 4732/week @ 2024-04-18 6467/week @ 2024-04-25 6474/week @ 2024-05-02 3940/week @ 2024-05-09 4308/week @ 2024-05-16 3895/week @ 2024-05-23 3165/week @ 2024-05-30

16,118 downloads per month
Used in 19 crates (16 directly)

MIT/Apache

17KB
333 lines

RustCrypto: SM3

crate Docs Apache2/MIT licensed Rust Version Project Chat Build Status

Pure Rust implementation of the SM3 cryptographic hash function defined in OSCCA GM/T 0004-2012.

Examples

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

let mut hasher = Sm3::new();
hasher.update(b"hello world");
let hash = hasher.finalize();

assert_eq!(hash, hex!("44f0061e69fa6fdfc290c494654a05dc0c053da7e5c52b84ef93a9d67d3fff88"));

Also, see the examples section in the RustCrypto/hashes readme.

Minimum Supported Rust Version

Rust 1.71 or higher.

Minimum supported Rust version can be changed in the future, but it will be done with a minor version bump.

SemVer Policy

  • All on-by-default features of this library are covered by SemVer
  • MSRV is considered exempt from SemVer as noted above

License

The crate is licensed under either of:

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

Dependencies

~285–450KB
~11K SLoC