Computes the SHA-256 digest of a byte sequence or a file. More...
#include <sha256.hpp>
Static Public Member Functions | |
| static std::string | hexadecimal_digest (const std::string &message) |
| Lowercase hexadecimal digest of the given bytes. | |
| static std::string | hexadecimal_digest_of_file (const std::string &path) |
Computes the SHA-256 digest of a byte sequence or a file.
Definition at line 33 of file sha256.hpp.
|
inlinestatic |
Lowercase hexadecimal digest of the given bytes.
Definition at line 36 of file sha256.hpp.
Referenced by hexadecimal_digest_of_file().
|
inlinestatic |
Lowercase hexadecimal digest of a file's contents.
Read as binary and hashed byte for byte, so the answer matches what any other tool reports for the same file rather than what it reports for some normalization of it.
A read error is an error, not a short file. fread() returns a short count for both end-of-file and failure, so a mid-file I/O error on an unchecked loop yields a perfectly well-formed digest – of a prefix. That is the one outcome this class must never produce: a confidently wrong identity is indistinguishable from a real one, which is the whole argument for hashing contents in the first place.
Definition at line 63 of file sha256.hpp.
References hexadecimal_digest().