28 #include <openssl/crypto.h>
45 namespace tr = security::transform;
53 namespace tr = security::transform;
55 m_input = make_unique<tr::StepSource>();
56 m_output = make_unique<OBufferStream>();
58 m_isFinalized =
false;
67 BOOST_ASSERT(m_input !=
nullptr);
72 return m_output->buf();
81 if (lhs.size() != rhs.size()) {
86 return CRYPTO_memcmp(lhs.data(), rhs.data(), lhs.size()) == 0;
99 update({
reinterpret_cast<const uint8_t*
>(str.data()), str.size()});
106 update({
reinterpret_cast<const uint8_t*
>(&value),
sizeof(uint64_t)});
123 BOOST_ASSERT(m_input !=
nullptr);
124 m_input->write(buffer);
General-purpose automatically managed/resized buffer.
An output stream that writes to a Buffer.
Provides stateful SHA-256 digest calculation.
ConstBufferPtr computeDigest()
Finalize and return the digest based on all previously supplied inputs.
Sha256()
Create an empty SHA-256 digest.
static const size_t DIGEST_SIZE
Length in bytes of a SHA-256 digest.
bool operator==(Sha256 &digest)
Check if the supplied digest is equal to this digest.
Sha256 & operator<<(Sha256 &src)
Add existing digest to the digest calculation.
std::string toString()
Convert digest to std::string.
void reset()
Discard the current state and start a new digest calculation.
void update(span< const uint8_t > buffer)
Add a byte buffer to the digest calculation.
std::ostream & operator<<(std::ostream &os, LogLevel level)
Output LogLevel as a string.
void printHex(std::ostream &os, uint64_t num, bool wantUpperCase)
Output the hex representation of num to the output stream os.
std::string toHex(span< const uint8_t > buffer, bool wantUpperCase)
Return a string containing the hex representation of the bytes in buffer.
shared_ptr< const Buffer > ConstBufferPtr