47#define EMSHA_CHECK(condition, retval) if (!(condition)) { return (retval); }
53#define EMSHA_CHECK(condition, retval) (assert((condition)))
126 std::uint32_t messageLength) = 0;
153 virtual std::uint32_t
Size() = 0;
177bool HashEqual(
const std::uint8_t *a,
const std::uint8_t *b);
180#ifndef EMSHA_NO_HEXSTRING
191void HexString(std::uint8_t *dest, std::uint8_t *src, std::uint32_t srclen);
virtual std::uint32_t Size()=0
Return the output size of the Hash.
virtual EMSHAResult Reset()=0
Bring the Hash back to its initial state.
virtual EMSHAResult Finalise(std::uint8_t *digest)=0
Carry out any final operations on the Hash.
virtual EMSHAResult Update(const std::uint8_t *message, std::uint32_t messageLength)=0
Write message data into the Hash.
virtual EMSHAResult Result(std::uint8_t *digest)=0
Result transfers out the hash to the argument.
bool HashEqual(const std::uint8_t *a, const std::uint8_t *b)
Constant-time function for comparing two digests.
const std::uint32_t SHA256_HASH_SIZE
SHA256_HASH_SIZE is the output length of SHA-256 in bytes.
Definition: emsha.h:57
void HexString(std::uint8_t *dest, std::uint8_t *src, std::uint32_t srclen)
Write a hex-encoded version of a byte string.
EMSHAResult
Describe the result of an EMSHA operation.
Definition: emsha.h:64
@ TestFailure
The self-test failed.
@ InputTooLong
The input to SHA256::update is too large.
@ OK
All operations have completed successfully so far.
@ InvalidState
The Hash is in an invalid state.