Base class for hash algorithms.
More...
#include <hash_base.h>
|
virtual | ~HashBase ()=default |
|
virtual void | init ()=0 |
| Initialize a new hash computation.
|
|
virtual void | add (const uint8_t *data, size_t len)=0 |
| Add bytes of data for the hash.
|
|
void | add (const char *data, size_t len) |
|
virtual void | calculate ()=0 |
| Compute the hash based on provided data.
|
|
void | get_bytes (uint8_t *output) |
| Retrieve the hash as bytes.
|
|
void | get_hex (char *output) |
| Retrieve the hash as hex characters.
|
|
bool | equals_bytes (const uint8_t *expected) |
| Compare the hash against a provided byte-encoded hash.
|
|
bool | equals_hex (const char *expected) |
| Compare the hash against a provided hex-encoded hash.
|
|
virtual size_t | get_size () const =0 |
| Get the size of the hash in bytes (16 for MD5, 32 for SHA256)
|
|
Base class for hash algorithms.
Definition at line 11 of file hash_base.h.
◆ ~HashBase()
virtual esphome::HashBase::~HashBase |
( |
| ) |
|
|
virtualdefault |
◆ add() [1/2]
void esphome::HashBase::add |
( |
const char * | data, |
|
|
size_t | len ) |
|
inline |
◆ add() [2/2]
virtual void esphome::HashBase::add |
( |
const uint8_t * | data, |
|
|
size_t | len ) |
|
pure virtual |
◆ calculate()
virtual void esphome::HashBase::calculate |
( |
| ) |
|
|
pure virtual |
◆ equals_bytes()
bool esphome::HashBase::equals_bytes |
( |
const uint8_t * | expected | ) |
|
|
inline |
Compare the hash against a provided byte-encoded hash.
Definition at line 38 of file hash_base.h.
◆ equals_hex()
bool esphome::HashBase::equals_hex |
( |
const char * | expected | ) |
|
|
inline |
Compare the hash against a provided hex-encoded hash.
Definition at line 41 of file hash_base.h.
◆ get_bytes()
void esphome::HashBase::get_bytes |
( |
uint8_t * | output | ) |
|
|
inline |
Retrieve the hash as bytes.
Definition at line 26 of file hash_base.h.
◆ get_hex()
void esphome::HashBase::get_hex |
( |
char * | output | ) |
|
|
inline |
Retrieve the hash as hex characters.
Definition at line 29 of file hash_base.h.
◆ get_size()
virtual size_t esphome::HashBase::get_size |
( |
| ) |
const |
|
pure virtual |
◆ init()
virtual void esphome::HashBase::init |
( |
| ) |
|
|
pure virtual |
◆ digest_
uint8_t esphome::HashBase::digest_[32] |
|
protected |
The documentation for this class was generated from the following file: