Wrapper class which allows generating a hash of a given type from any arbitrary byte payload, which is hashable in chunks.
More...
#include <HashGenerator.h>
|
| struct | HashString |
| | Wrapper class for the char array that is big enough to hold the string representation of every possible hash algorithm. More...
|
| |
Wrapper class which allows generating a hash of a given type from any arbitrary byte payload, which is hashable in chunks.
- Note
- The class wraps around either the Arduino Seeed mbedtls library from Seed Studio (https://github.com/Seeed-Studio/Seeed_Arduino_mbedtls) or the offical ESP Mbed TLS implementation from Mbed TLS (https://github.com/Mbed-TLS/mbedtls), the latter takes precendence if it exists. This is done because it removes the need to include another library, because the component already exists on the system and we can therefore simply utilize that one. The ESP Mbed TLS implementationt works with both Espressif IDF v4.X and v5.X, meaning it is version idependent, this is the case because depending on the used version the implementation automatically adjusts to still initalize correctly. The class instance is meant to be started with start() which will then create the configuration for a hash of the given type and we then expect the complete binary payload to be called in multiple calls to update() and the final result to be read with finish(). Documentation about the specific use and caviates of the ESP Mbedt TLS implementation can be found here https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-reference/protocols/mbedtls.html
◆ HashGenerator() [1/2]
| HashGenerator::HashGenerator |
( |
void |
| ) |
|
|
default |
◆ HashGenerator() [2/2]
Deleted copy constructor.
- Note
- Copying an active HashGenerator is not possible and there are no settings or configuration to copy. Therefore copying is disabled alltogether
- Parameters
-
| other | Other instance we disallow copying from |
◆ ~HashGenerator()
| HashGenerator::~HashGenerator |
( |
void |
| ) |
|
◆ finish()
Calculates the final hash string representation and stops the hash calculation no further calls to update() will work, instead the same context can be reused to start another hash calculation operation with start()
- Returns
- Hash string representation of the previously entered hashed binary data, if the hashing process failed the hash string representation will be empty
◆ operator=()
Deleted copy assignment operator.
- Note
- Copying an active HashGenerator is not possible and there are no settings or configuration to copy. Therefore copying is disabled alltogether
- Parameters
-
| other | Other instance we disallow copying from |
◆ start()
Starts the hashing process.
- Parameters
-
| type | Supported type of hash that should be generated from the given binary data |
- Returns
- Whether initalizing and starting the hash calculation was successful or not
◆ update()
| bool HashGenerator::update |
( |
uint8_t const * |
data, |
|
|
size_t const & |
length |
|
) |
| |
Update the current hash value with new data.
- Parameters
-
| data | Non owning pointer to the data that should be added to generate the hash. Does not need to kept alive as the update function copies the data by writing it into the hash function storage |
| length | Length of data entered |
- Returns
- Whether updating the hash for the given bytes was successful or not
The documentation for this class was generated from the following files: