|
libxcks
0.1.0.1
|
Computes the SM3 hash from a byte stream. More...
#include <sm3.hpp>


Public Member Functions | |
| SM3 () | |
| Default constructor. More... | |
| void | reset () override |
| Resets the SM3 hash to initial state of computation. More... | |
| uint8_t * | getValue (uint8_t *buffer) const override |
| Returns the SM3 hash value in the first 32 bytes of the given address. More... | |
| size_t | getSize () const override |
| Returns the minimal size to allocate in memory to store the hash with the getValue(buffer) method. More... | |
| void | update (const uint8_t *buf, size_t len) override |
| Updates the SM3 hash with specified array of bytes. More... | |
| std::string | getName () const override |
| Returns the name of the checksum or the hash algorithm. More... | |
| ChecksumAlgoId | getID () const override |
| Returns an unique identifier for the checksum or the hash algorithm. More... | |
Public Member Functions inherited from libxcks::ChecksumEx | |
| std::string | toString (const bool hexInUpperCase=false) const override |
| Returns the hash value has a string. More... | |
Public Member Functions inherited from libxcks::Checksum | |
| virtual | ~Checksum () |
| Destructor. More... | |
| virtual ArrayString | getAltNames () const |
| Returns the alternative name(s) of the checksum or the hash algorithm. More... | |
Static Public Member Functions | |
| static std::string | getHashName () |
| Returns the name of the hash algorithm. More... | |
| static constexpr ChecksumAlgoId | getIdentifier () |
| Returns an unique identifier for the hash algorithm. More... | |
| static Checksum * | getNewInstance () |
| Gets a new instance of this class. More... | |
Static Public Member Functions inherited from libxcks::Checksum | |
| static ArrayString | getAlternativeNames () |
| Returns the alternative name(s) of the checksum or the hash algorithm. More... | |
Additional Inherited Members | |
Static Protected Member Functions inherited from libxcks::ChecksumEx | |
| static uint32_t | swapOnLE (const uint32_t value) |
| Swaps bytes on little endian architectures. More... | |
| static uint32_t | swapOnBE (const uint32_t value) |
| Swaps bytes on big endian architectures. More... | |
| static uint64_t | swapOnLE (const uint64_t value) |
| Swaps bytes on little endian architectures. More... | |
| static uint64_t | swapOnBE (const uint64_t value) |
| Swaps bytes on big endian architectures. More... | |
Computes the SM3 hash from a byte stream.
This class is a rewrite in C++ of the SM3 hash computing algorithm from an C implementation. Please see the GitHub project website for more informations.
Using this class in very simple:
Use the update method to provide to the class the bytes for computing the hash.
The SM3 hash value can be gotten by two ways:
| libxcks::SM3::SM3 | ( | ) |
Default constructor.
|
inlinestatic |
|
inlineoverridevirtual |
Returns an unique identifier for the checksum or the hash algorithm.
Implements libxcks::Checksum.
|
inlinestaticconstexpr |
Returns an unique identifier for the hash algorithm.
|
inlineoverridevirtual |
Returns the name of the checksum or the hash algorithm.
Implements libxcks::Checksum.
|
inlinestatic |
|
inlineoverridevirtual |
Returns the minimal size to allocate in memory to store the hash with the getValue(buffer) method.
Implements libxcks::Checksum.
|
overridevirtual |
Returns the SM3 hash value in the first 32 bytes of the given address.
| buffer | The buffer where the SM3 hash value will be stored. |
Implements libxcks::Checksum.
|
overridevirtual |
Resets the SM3 hash to initial state of computation.
Implements libxcks::ChecksumEx.
|
overridevirtual |
Updates the SM3 hash with specified array of bytes.
| buf | The byte array to update the SM3 hash with. |
| len | The number of bytes to use for the update. |
Implements libxcks::Checksum.