39 virtual void update(
const void *data,
size_t len) = 0;
40 virtual void finalize(
void *hash,
size_t len) = 0;
44 virtual void resetHMAC(
const void *key,
size_t keyLen) = 0;
45 virtual void finalizeHMAC(
const void *key,
size_t keyLen,
void *hash,
size_t hashLen) = 0;
48 void formatHMACKey(
void *block,
const void *key,
size_t len, uint8_t pad);
51 template <
typename T>
void hmac
52 (
void *out,
size_t outLen,
const void *key,
size_t keyLen,
53 const void *data,
size_t dataLen)
56 context.resetHMAC(key, keyLen);
57 context.update(data, dataLen);
58 context.finalizeHMAC(key, keyLen, out, outLen);
Abstract base class for cryptographic hash algorithms.
virtual void finalize(void *hash, size_t len)=0
Finalizes the hashing process and returns the hash.
virtual void clear()=0
Clears the hash state, removing all sensitive data, and then resets the hash ready for a new hashing ...
virtual size_t blockSize() const =0
Size of the internal block used by the hash algorithm.
virtual ~Hash()
Destroys this hash object.
virtual void reset()=0
Resets the hash ready for a new hashing process.
virtual void finalizeHMAC(const void *key, size_t keyLen, void *hash, size_t hashLen)=0
Finalizes the HMAC hashing process and returns the hash.
void formatHMACKey(void *block, const void *key, size_t len, uint8_t pad)
Formats a HMAC key into a block.
virtual size_t hashSize() const =0
Size of the hash result from finalize().
virtual void resetHMAC(const void *key, size_t keyLen)=0
Resets the hash ready for a new HMAC hashing process.
virtual void update(const void *data, size_t len)=0
Updates the hash with more data.
Hash()
Constructs a new hash object.