Thrill
0.1
|
SHA-256 processor without external dependencies.
Definition at line 28 of file sha256.hpp.
#include <sha256.hpp>
Public Member Functions | |
SHA256 () | |
construct empty object. More... | |
SHA256 (const void *data, uint32_t size) | |
construct context and process data range More... | |
SHA256 (const std::string &str) | |
construct context and process string More... | |
std::string | digest () |
finalize computation and return 32 byte (256 bit) digest More... | |
std::string | digest_hex () |
finalize computation and return 32 byte (256 bit) digest hex encoded More... | |
std::string | digest_hex_uc () |
finalize computation and return 32 byte (256 bit) digest upper-case hex More... | |
void | finalize (void *digest) |
finalize computation and output 32 byte (256 bit) digest More... | |
void | process (const void *data, uint32_t size) |
process more data More... | |
void | process (const std::string &str) |
process more data More... | |
Static Public Attributes | |
static constexpr size_t | kDigestLength = 32 |
digest length in bytes More... | |
Private Attributes | |
uint8_t | buf_ [64] |
uint32_t | curlen_ |
uint64_t | length_ |
uint32_t | state_ [8] |
SHA256 | ( | ) |
construct empty object.
Definition at line 131 of file sha256.cpp.
References SHA256::curlen_, SHA256::length_, and SHA256::state_.
Referenced by tlx::sha256_hex(), and tlx::sha256_hex_uc().
SHA256 | ( | const void * | data, |
uint32_t | size | ||
) |
construct context and process data range
Definition at line 144 of file sha256.cpp.
References SHA256::process().
|
explicit |
construct context and process string
Definition at line 149 of file sha256.cpp.
References SHA256::process().
std::string digest | ( | ) |
finalize computation and return 32 byte (256 bit) digest
Definition at line 220 of file sha256.cpp.
References SHA256::finalize(), and SHA256::kDigestLength.
Referenced by SHA256::digest_hex(), and SHA256::digest_hex_uc().
std::string digest_hex | ( | ) |
finalize computation and return 32 byte (256 bit) digest hex encoded
Definition at line 226 of file sha256.cpp.
References SHA256::digest(), SHA256::finalize(), tlx::hexdump_lc(), and SHA256::kDigestLength.
std::string digest_hex_uc | ( | ) |
finalize computation and return 32 byte (256 bit) digest upper-case hex
Definition at line 232 of file sha256.cpp.
References SHA256::digest(), SHA256::finalize(), tlx::hexdump(), and SHA256::kDigestLength.
void finalize | ( | void * | digest | ) |
finalize computation and output 32 byte (256 bit) digest
Definition at line 189 of file sha256.cpp.
References SHA256::buf_, SHA256::curlen_, SHA256::length_, SHA256::state_, and tlx::digest_detail::store64().
Referenced by SHA256::digest(), SHA256::digest_hex(), and SHA256::digest_hex_uc().
void process | ( | const void * | data, |
uint32_t | size | ||
) |
process more data
Definition at line 154 of file sha256.cpp.
References SHA256::buf_, SHA256::curlen_, SHA256::length_, min(), and SHA256::state_.
Referenced by SHA256::process(), and SHA256::SHA256().
void process | ( | const std::string & | str | ) |
|
private |
Definition at line 60 of file sha256.hpp.
Referenced by SHA256::finalize(), and SHA256::process().
|
private |
Definition at line 59 of file sha256.hpp.
Referenced by SHA256::finalize(), SHA256::process(), and SHA256::SHA256().
|
static |
digest length in bytes
Definition at line 44 of file sha256.hpp.
Referenced by SHA256::digest(), SHA256::digest_hex(), and SHA256::digest_hex_uc().
|
private |
Definition at line 57 of file sha256.hpp.
Referenced by SHA256::finalize(), SHA256::process(), and SHA256::SHA256().
|
private |
Definition at line 58 of file sha256.hpp.
Referenced by SHA256::finalize(), SHA256::process(), and SHA256::SHA256().