#crypto #sm4 #block-cipher

no-std sm4

SM4 block cipher algorithm

7 releases (breaking)

Uses new Rust 2021

0.5.1 Feb 17, 2022
0.5.0 Feb 10, 2022
0.4.0 Apr 29, 2021
0.3.0 Oct 16, 2020
0.0.0 Oct 14, 2019

#250 in Cryptography

Download history 547/week @ 2022-06-12 459/week @ 2022-06-19 470/week @ 2022-06-26 609/week @ 2022-07-03 476/week @ 2022-07-10 562/week @ 2022-07-17 500/week @ 2022-07-24 872/week @ 2022-07-31 830/week @ 2022-08-07 278/week @ 2022-08-14 587/week @ 2022-08-21 194/week @ 2022-08-28 231/week @ 2022-09-04 214/week @ 2022-09-11 215/week @ 2022-09-18 241/week @ 2022-09-25

919 downloads per month
Used in wedpr_l_crypto_block_cipher_sm4


162 lines

RustCrypto: SM4 Cipher

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

Pure Rust implementation of the SM4 block cipher.


⚠️ Security Warning: Hazmat!

This crate does not ensure ciphertexts are authentic (i.e. by using a MAC to verify ciphertext integrity), which can lead to serious vulnerabilities if used incorrectly!

No security audits of this crate have ever been performed, and it has not been thoroughly assessed to ensure its operation is constant-time on common CPU architectures.


Minimum Supported Rust Version

Rust 1.56 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


Licensed under either of:

at your option.


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.