44 namespace tr = security::transform;
52 namespace tr = security::transform;
54 m_input = make_unique<tr::StepSource>();
55 m_output = make_unique<OBufferStream>();
57 m_isFinalized =
false;
66 BOOST_ASSERT(m_input !=
nullptr);
71 return m_output->buf();
80 if (lhs.size() != rhs.size()) {
85 return CRYPTO_memcmp(lhs.data(), rhs.data(), lhs.size()) == 0;
98 update({
reinterpret_cast<const uint8_t*
>(str.data()), str.size()});
105 update({
reinterpret_cast<const uint8_t*
>(&
value),
sizeof(uint64_t)});
110 Sha256::operator<<(span<const uint8_t> bytes)
122 BOOST_ASSERT(m_input !=
nullptr);
123 m_input->write(buffer);
Copyright (c) 2011-2015 Regents of the University of California.
std::string toHex(span< const uint8_t > buffer, bool wantUpperCase)
Return a string containing the hex representation of the bytes in buffer.
Provides stateful SHA-256 digest calculation.
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.
void update(span< const uint8_t > buffer)
Add a byte buffer to the digest calculation.
std::string toString()
Convert digest to std::string.
Sha256()
Create an empty SHA-256 digest.
void reset()
Discard the current state and start a new digest calculation.
Use the SHA-256 hash of the public key as key id.
ConstBufferPtr computeDigest()
Finalize and return the digest based on all previously supplied inputs.
void printHex(std::ostream &os, uint64_t num, bool wantUpperCase)
Output the hex representation of num to the output stream os.
implements an output stream that constructs ndn::Buffer
Sha256 & operator<<(Sha256 &src)
Add existing digest to the digest calculation.
General-purpose automatically managed/resized buffer.
shared_ptr< const Buffer > ConstBufferPtr