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. More... | |
~Hashing () | |
Destroys an Hashing struct. More... | |
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. More... | |
bool | getHash (Result &res) |
Finalize hash computation that has been pushed through Hashing::add. More... | |
bool | setType (Type newType) |
Set type of hash to compute. More... | |
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 bool SC::Hashing::getHash | ( | Result & | res | ) |
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 bool SC::Hashing::setType | ( | Type | newType | ) |
Set type of hash to compute.
newType | MD5, SHA1, SHA256 |
true
if the hash type has been changed successfully