|
SHA1 / SHA256 and HMAC-SHA1 / HMAC-SHA256 Hash library
SHA1 / SHA256 and HMAC-SHA1 / HMACSHA256 Hash library
|
#include <sha1.h>
Inheritance diagram for Sha1Class:Classes | |
| union | _buffer |
| union | _state |
Public Member Functions | |
| void | init (void) |
| void | initHmac (const uint8_t *secret, int secretLength) |
| uint8_t * | result (void) |
| uint8_t * | resultHmac (void) |
| virtual size_t | write (uint8_t) |
| size_t | write_L (const char *str) |
| size_t | write_L (const uint8_t *buffer, size_t size) |
| size_t | print (const char *str) |
| double | millis () |
| virtual size_t | write (uint8_t) |
Private Member Functions | |
| void | pad () |
| void | addUncounted (uint8_t data) |
| void | hashBlock () |
| uint32_t | rol32 (uint32_t number, uint8_t bits) |
Private Attributes | |
| _buffer | buffer |
| uint8_t | bufferOffset |
| _state | state |
| uint32_t | byteCount |
| uint8_t | keyBuffer [BLOCK_LENGTH] |
| uint8_t | innerHash [HASH_LENGTH] |
| timeval | tv |
| void Sha1Class::init | ( | void | ) |
Initialized the SHA1 process Set the counter and buffers
| void Sha1Class::initHmac | ( | const uint8_t * | secret, |
| int | secretLength | ||
| ) |
initializes the HMAC process for SHA-1
| secret | The key to be used |
| secretLength | The length of the key |
| uint8_t * Sha1Class::result | ( | void | ) |
Pads the last block and finalizes the hash.
| uint8_t * Sha1Class::resultHmac | ( | void | ) |
Pads the last block and finalizes the hash.
|
virtual |
Adds data to the buffer. Also increases the byteCount variable
| size_t Sha1Class::write_L | ( | const char * | str | ) |
Adds the str to the buffer Calles function in order to add the data into the buffer.
| str | The string to be added |
| size_t Sha1Class::write_L | ( | const uint8_t * | buffer, |
| size_t | size | ||
| ) |
Adds the string to the buffer Calles function in order to add the data into the buffer.
| *buffer | The string to be added |
| *size | The size of the string |
| size_t Sha1Class::print | ( | const char * | str | ) |
Adds the str to the buffer Calles functions in order to add the data into the buffer.
| str | The string to be added |
| double Sha1Class::millis | ( | ) |
used in linux in order to retrieve the time in milliseconds.
|
virtual |
Adds data to the buffer. Also increases the byteCount variable
|
private |
Implement SHA-1 padding (fips180-2 ยง5.1.1). Pad with 0x80 followed by 0x00 until the end of the block
|
private |
adds the data to the buffer
| data |
|
private |
Hash a single block of data
|
private |
rol32 - rotate a 32-bit value left
| number | value to rotate |
| bits | bits to roll |
|
private |
hold the buffer for the hashing process
|
private |
indicates the position on the buffer
|
private |
identical structure with buffer
|
private |
Byte counter in order to initialize the hash process for a block
|
private |
Hold the key for the HMAC process
|
private |
holds the inner hash for the HMAC process
|
private |
hold the time value on linux machines (ex Raspberry Pi)
1.8.9.1