Compute MD5, SHA1 or SHA256 hash for stream of data. More...
#include <Hashing.h>
Classes | |
| struct | Result |
Public Types | |
| enum | Type { TypeMD5 , TypeSHA1 , TypeSHA256 } |
Public Member Functions | |
| Hashing () | |
| Initializes an Hashing struct. | |
| ~Hashing () | |
| Destroys an Hashing struct. | |
| Hashing (const Hashing &)=delete | |
| Hashing (Hashing &&)=delete | |
| Hashing & | operator= (const Hashing &)=delete |
| Hashing & | operator= (Hashing &&)=delete |
| bool | add (Span< const uint8_t > data) |
| Add data to be hashed. | |
| bool | getHash (Result &res) |
| Finalize hash computation that has been pushed through Hashing::add. | |
| bool | setType (Type newType) |
| Set type of hash to compute. | |
Compute MD5, SHA1 or SHA256 hash for stream of data.
Data can be added until needed with SC::Hashing::add call. SC::Hashing::getHash will generate an actual SC::Hashing::Result holding the computed hash.
Example:
Example with update (for hashing longer streams of data):
| enum SC::Hashing::Type |
| SC::Hashing::Hashing | ( | ) |
Initializes an Hashing struct.
| SC::Hashing::~Hashing | ( | ) |
Destroys an Hashing struct.
Add data to be hashed.
Can be called multiple times before Hashing::getHash
| data | Data to be hashed |
true if data has been hashed successfully
|
nodiscard |
Finalize hash computation that has been pushed through Hashing::add.
| [out] | res | Result object holding the actual Result::hash |
true if the final hash has been computed successfully
|
nodiscard |
Set type of hash to compute.
| newType | MD5, SHA1, SHA256 |
true if the hash type has been changed successfully