Util: add de_hex() fun
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
dc1ab343eb
commit
fa9dc26f66
13
util.h
13
util.h
@ -16,6 +16,19 @@ class Util final {
|
|||||||
public:
|
public:
|
||||||
static constexpr const std::size_t gen_block_size{32}; // 256 bits
|
static constexpr const std::size_t gen_block_size{32}; // 256 bits
|
||||||
|
|
||||||
|
static auto de_hex(const std::string& str) -> const std::string {
|
||||||
|
std::string s{str};
|
||||||
|
std::string dst;
|
||||||
|
CryptoPP::HexDecoder decoder;
|
||||||
|
|
||||||
|
decoder.Put(reinterpret_cast<CryptoPP::byte*>(s.data()), s.size());
|
||||||
|
decoder.MessageEnd();
|
||||||
|
dst.resize(gen_block_size);
|
||||||
|
decoder.Get(reinterpret_cast<CryptoPP::byte*>(&dst[0]), dst.size());
|
||||||
|
|
||||||
|
return dst;
|
||||||
|
}
|
||||||
|
|
||||||
static auto do_sha(const std::string& str_to_hash) -> const std::string {
|
static auto do_sha(const std::string& str_to_hash) -> const std::string {
|
||||||
// do sha256
|
// do sha256
|
||||||
std::string digest;
|
std::string digest;
|
||||||
|
Reference in New Issue
Block a user