29 template<
typename Hash>
35 template<
typename Hash>
37 : m_isInProcess(false)
42 m_buffer = make_shared<Buffer>(m_hash.DigestSize());
44 new HashFilter(m_hash,
45 new ArraySink(m_buffer->get(), m_buffer->size())));
48 template<
typename Hash>
53 m_buffer = make_shared<Buffer>(m_hash.DigestSize());
54 m_isInProcess =
false;
55 m_isFinalized =
false;
58 template<
typename Hash>
66 m_hash.Final(m_buffer->get());
71 template<
typename Hash>
79 template<
typename Hash>
86 template<
typename Hash>
91 update(buffer->get(), buffer->size());
96 template<
typename Hash>
100 update(reinterpret_cast<const uint8_t*>(str.c_str()), str.size());
105 template<
typename Hash>
114 template<
typename Hash>
118 update(reinterpret_cast<const uint8_t*>(&value),
sizeof(uint64_t));
123 template<
typename Hash>
129 BOOST_THROW_EXCEPTION(
Error(
"Digest has been already finalized"));
131 m_hash.Update(buffer, size);
133 m_isInProcess =
true;
136 template<
typename Hash>
141 BufferPtr result = make_shared<Buffer>(hash.DigestSize());
142 hash.Update(buffer, size);
143 hash.Final(result->get());
148 template<
typename Hash>
152 std::ostringstream os;
158 template<
typename Hash>
160 operator<<(std::ostream& os, Digest<Hash>& digest)
163 printHex(os, buffer->buf(), buffer->size());
173 operator<<(std::ostream& os, Digest<CryptoPP::SHA256>& digest);
Copyright (c) 2011-2015 Regents of the University of California.
void reset()
Discard the current state and start a new digest.
Copyright (c) 2013-2014 Regents of the University of California.
shared_ptr< Buffer > BufferPtr
const uint8_t * wire() const
Class representing a wire element of NDN-TLV packet format.
void printHex(std::ostream &os, const uint8_t *buffer, size_t length, bool isUpperCase)
Output the hex representation of the bytes in array to the output stream os.
provides a digest calculation
Digest< Hash > & operator<<(Digest< Hash > &src)
Add existing digest to digest calculation.
void update(const uint8_t *buffer, size_t size)
Add a buffer to digest calculation.
ConstBufferPtr computeDigest()
Obtain the digest.
bool operator==(Digest< Hash > &digest)
Check if supplied digest equal to this digest.
shared_ptr< const Buffer > ConstBufferPtr
std::string toString()
Convert digest to std::string.