digestpp 1.0
C++11 header-only message digest library
Loading...
Searching...
No Matches
SM3

SM3 Algorithm More...

Typedefs

typedef hasher< detail::sm3_providerdigestpp::sm3
 SM3 hash function.
 

Detailed Description

SM3 Algorithm

Typedef Documentation

◆ sm3

SM3 hash function.

Chinese national standard hash function (GB/T 32905-2016). Designed by Xiaoyun Wang, Hongbo Yu, and Yiqun Lisa Yin.

SM3 is part of the Chinese ShangMi (Commercial Cryptography) suite of cryptographic algorithms. It is mandatory for use in Chinese government and commercial applications.

The algorithm is similar in structure to SHA-256, using a Merkle-Damgård construction with 32-bit operations, but with different constants, rotation amounts, and message schedule.

Chinese national standard (GB/T 32905-2016). Also standardized as ISO/IEC 10118-3:2018

Type:
Cryptographic hash function.
Output size:
256 bits
Default size:
256 bits
Example:
// Output a SM3 digest of a string
hasher.absorb("The quick brown fox jumps over the lazy dog");
std::cout << hasher.hexdigest() << '\n';
Main class template implementing the public API for hashing.
Definition hasher.hpp:38
std::string hexdigest() const
Return hex digest of absorbed data.
Definition hasher.hpp:372
hasher & absorb(const T *data, size_t len)
Absorbs bytes from a C-style pointer to character buffer.
Definition hasher.hpp:86
Example output:
5fdfe814b8573ca021983970fc79b2218c9570369b4859684e2e4c3fc76cb8ea
See also
hasher, sha256