provides a stateful digest calculation More...
#include <digest.hpp>
Data Structures | |
class | Error |
Public Types | |
typedef Hash | HashFunction |
Public Member Functions | |
Digest () | |
Digest (std::istream &is) | |
Calculate digest of the input stream is . More... | |
void | reset () |
Discard the current state and start a new digest calculation. More... | |
bool | empty () const |
Check if digest is empty. More... | |
ConstBufferPtr | computeDigest () |
Finalize and return the digest based on all previously supplied inputs. More... | |
bool | operator== (Digest< Hash > &digest) |
Check if the supplied digest equals to this digest. More... | |
bool | operator!= (Digest< Hash > &digest) |
Check if the supplied digest is not equal to this digest. More... | |
Digest< Hash > & | operator<< (Digest< Hash > &src) |
Add existing digest to the digest calculation. More... | |
Digest< Hash > & | operator<< (const std::string &str) |
Add string to the digest calculation. More... | |
Digest< Hash > & | operator<< (const Block &block) |
Add block to the digest calculation. More... | |
Digest< Hash > & | operator<< (uint64_t value) |
Add uint64_t value to the digest calculation. More... | |
void | update (const uint8_t *buffer, size_t size) |
Add a buffer to the digest calculation. More... | |
std::string | toString () |
Convert digest to std::string. More... | |
Static Public Member Functions | |
static ConstBufferPtr | computeDigest (const uint8_t *buffer, size_t size) |
Compute one-time digest. More... | |
Data Fields | |
Hashable< Hash > | |
provides a stateful digest calculation
SHA256 example:
Digest<CryptoPP::SHA256> digest; digest.update(buf1, size1); digest.update(buf2, size2); ... ConstBufferPtr result = digest.computeDigest();
Definition at line 45 of file digest.hpp.
typedef Hash ndn::util::Digest< Hash >::HashFunction |
Definition at line 50 of file digest.hpp.
ndn::util::Digest< Hash >::Digest | ( | ) |
Definition at line 32 of file digest.cpp.
|
explicit |
Calculate digest of the input stream is
.
is | input stream |
Definition at line 38 of file digest.cpp.
ConstBufferPtr ndn::util::Digest< Hash >::computeDigest | ( | ) |
Finalize and return the digest based on all previously supplied inputs.
Definition at line 75 of file digest.cpp.
|
static |
Compute one-time digest.
buffer | the input buffer |
size | the size of the input buffer. |
Hash
algorithm Definition at line 148 of file digest.cpp.
|
inline |
Check if digest is empty.
An empty digest means nothing has been taken into calculation.
Definition at line 83 of file digest.hpp.
|
inline |
Check if the supplied digest is not equal to this digest.
Definition at line 108 of file digest.hpp.
Digest< Hash > & ndn::util::Digest< Hash >::operator<< | ( | const Block & | block | ) |
Add block to the digest calculation.
block | data block to put into digest |
Error | the digest has been finalized. |
Definition at line 117 of file digest.cpp.
Digest< Hash > & ndn::util::Digest< Hash >::operator<< | ( | uint64_t | value | ) |
Add uint64_t value to the digest calculation.
value | the integer value to put into digest |
Error | the digest has been finalized. |
Definition at line 126 of file digest.cpp.
Digest< Hash > & ndn::util::Digest< Hash >::operator<< | ( | const std::string & | str | ) |
Add string to the digest calculation.
str | string to put into digest |
Definition at line 108 of file digest.cpp.
Digest< Hash > & ndn::util::Digest< Hash >::operator<< | ( | Digest< Hash > & | src | ) |
Add existing digest to the digest calculation.
src | digest to combine with |
The result of this combination is digest(digest(...))
Definition at line 98 of file digest.cpp.
bool ndn::util::Digest< Hash >::operator== | ( | Digest< Hash > & | digest | ) |
Check if the supplied digest equals to this digest.
Definition at line 83 of file digest.cpp.
void ndn::util::Digest< Hash >::reset | ( | ) |
Discard the current state and start a new digest calculation.
Definition at line 52 of file digest.cpp.
std::string ndn::util::Digest< Hash >::toString | ( | ) |
Convert digest to std::string.
Definition at line 160 of file digest.cpp.
void ndn::util::Digest< Hash >::update | ( | const uint8_t * | buffer, |
size_t | size | ||
) |
Add a buffer to the digest calculation.
Update the state of the digest if it has not been finalized and mark the digest as InProcess.
buffer | the input buffer |
size | the size of the input buffer. |
Error | the digest has been finalized. |
Definition at line 135 of file digest.cpp.
ndn::util::Digest< Hash >::Hashable< Hash > |
Definition at line 48 of file digest.hpp.