24 #include "ndn-cxx/security/impl/openssl.hpp" 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;
92 update(buf->data(), buf->size());
99 update(reinterpret_cast<const uint8_t*>(str.data()), str.size());
113 update(reinterpret_cast<const uint8_t*>(&value),
sizeof(uint64_t));
123 BOOST_ASSERT(m_input !=
nullptr);
124 m_input->write(buffer, size);
139 sha256.
update(buffer, size);
Provides stateful SHA-256 digest calculation.
std::string toHex(const uint8_t *buffer, size_t length, bool wantUpperCase)
Return a string containing the hex representation of the bytes in buffer.
static const size_t DIGEST_SIZE
Length in bytes of a SHA-256 digest.
const uint8_t * wire() const
Return a raw pointer to the beginning of the encoded wire.
bool operator==(Sha256 &digest)
Check if the supplied digest is equal to this digest.
Represents a TLV element of the NDN packet format.
std::string toString()
Convert digest to std::string.
Sha256()
Create an empty SHA-256 digest.
void update(const uint8_t *buffer, size_t size)
Add a raw buffer to the digest calculation.
size_t size() const
Return the size of the encoded wire, i.e.
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