ArduinoLibs
|
SHA-512 hash algorithm. More...
#include <SHA512.h>
Public Member Functions | |
SHA512 () | |
Constructs a SHA-512 hash object. | |
virtual | ~SHA512 () |
Destroys this SHA-512 hash object after clearing sensitive information. | |
size_t | hashSize () const |
Size of the hash result from finalize(). More... | |
size_t | blockSize () const |
Size of the internal block used by the hash algorithm. More... | |
void | reset () |
Resets the hash ready for a new hashing process. More... | |
void | update (const void *data, size_t len) |
Updates the hash with more data. More... | |
void | finalize (void *hash, size_t len) |
Finalizes the hashing process and returns the hash. More... | |
void | clear () |
Clears the hash state, removing all sensitive data, and then resets the hash ready for a new hashing process. More... | |
void | resetHMAC (const void *key, size_t keyLen) |
Resets the hash ready for a new HMAC hashing process. More... | |
void | finalizeHMAC (const void *key, size_t keyLen, void *hash, size_t hashLen) |
Finalizes the HMAC hashing process and returns the hash. More... | |
![]() | |
Hash () | |
Constructs a new hash object. | |
virtual | ~Hash () |
Destroys this hash object. More... | |
Friends | |
class | Ed25519 |
Additional Inherited Members | |
![]() | |
void | formatHMACKey (void *block, const void *key, size_t len, uint8_t pad) |
Formats a HMAC key into a block. More... | |
SHA-512 hash algorithm.
Reference: http://en.wikipedia.org/wiki/SHA-2
|
virtual |
Size of the internal block used by the hash algorithm.
Implements Hash.
Definition at line 61 of file SHA512.cpp.
|
virtual |
Clears the hash state, removing all sensitive data, and then resets the hash ready for a new hashing process.
Implements Hash.
Definition at line 136 of file SHA512.cpp.
|
virtual |
Finalizes the hashing process and returns the hash.
hash | The buffer to return the hash value in. |
len | The length of the hash buffer, normally hashSize(). |
If len is less than hashSize(), then the hash value will be truncated to the first len bytes. If len is greater than hashSize(), then the remaining bytes will left unchanged.
If finalize() is called again, then the returned hash value is undefined. Call reset() first to start a new hashing process.
Implements Hash.
Definition at line 105 of file SHA512.cpp.
|
virtual |
Finalizes the HMAC hashing process and returns the hash.
key | Points to the HMAC key for the hashing process. The contents of this array must be identical to the value passed to resetHMAC(). |
keyLen | Size of the HMAC key in bytes. |
hash | The buffer to return the hash value in. |
hashLen | The length of the hash buffer, normally hashSize(). |
Implements Hash.
Definition at line 149 of file SHA512.cpp.
|
virtual |
Size of the hash result from finalize().
Implements Hash.
Definition at line 56 of file SHA512.cpp.
|
virtual |
Resets the hash ready for a new hashing process.
Implements Hash.
Definition at line 66 of file SHA512.cpp.
|
virtual |
Resets the hash ready for a new HMAC hashing process.
key | Points to the HMAC key for the hashing process. |
keyLen | Size of the HMAC key in bytes. |
The following example computes a HMAC over a series of data blocks with a specific key:
The same key must be passed to both resetHMAC() and finalizeHMAC().
Implements Hash.
Definition at line 142 of file SHA512.cpp.
|
virtual |
Updates the hash with more data.
data | Data to be hashed. |
len | Number of bytes of data to be hashed. |
If finalize() has already been called, then the behavior of update() will be undefined. Call reset() first to start a new hashing process.
Implements Hash.
Definition at line 79 of file SHA512.cpp.