|
Lightweight Cryptography Primitives
|
SHA256 implementation for performance comparisons. More...
Go to the source code of this file.
Data Structures | |
| struct | sha256_state_t |
| State for SHA256 incremental mode. More... | |
Macros | |
| #define | SHA256_HASH_SIZE 32 |
| Size of the hash for SHA256. | |
Functions | |
| int | internal_sha256_hash (unsigned char *out, const unsigned char *in, size_t inlen) |
| Hashes a block of input data with SHA256 to generate a hash value. More... | |
| void | internal_sha256_hash_init (sha256_state_t *state) |
| Initializes the state for a SHA256 hashing operation. More... | |
| void | internal_sha256_hash_update (sha256_state_t *state, const unsigned char *in, size_t inlen) |
| Updates a SHA256 state with more input data. More... | |
| void | internal_sha256_hash_finalize (sha256_state_t *state, unsigned char *out) |
| Returns the final hash value from a SHA256 hashing operation. More... | |
| void | internal_sha256_hmac (unsigned char *out, const unsigned char *key, size_t keylen, const unsigned char *in, size_t inlen) |
| Computes a HMAC value using SHA256. More... | |
| void | internal_sha256_hmac_init (sha256_state_t *state, const unsigned char *key, size_t keylen) |
| Initializes an incremental HMAC state using SHA256. More... | |
| void | internal_sha256_hmac_update (sha256_state_t *state, const unsigned char *in, size_t inlen) |
| Updates an incremental SHA256-HMAC state with more input data. More... | |
| void | internal_sha256_hmac_finalize (sha256_state_t *state, const unsigned char *key, size_t keylen, unsigned char *out) |
| Finalizes an incremental SHA256-HMAC state. More... | |
Variables | |
| aead_hash_algorithm_t const | internal_sha256_hash_algorithm |
| Meta-information block for the SHA256 hash algorithm. | |
SHA256 implementation for performance comparisons.
SHA256 is not one of the NIST lightweight submissions. We use it as a comparison to evaluate the performance of other hash algorithsm.
This SHA256 implementation is based on the one from the Arduino Cryptography Library.
| int internal_sha256_hash | ( | unsigned char * | out, |
| const unsigned char * | in, | ||
| size_t | inlen | ||
| ) |
Hashes a block of input data with SHA256 to generate a hash value.
| out | Buffer to receive the hash output which must be at least SHA256_HASH_SIZE bytes in length. |
| in | Points to the input data to be hashed. |
| inlen | Length of the input data in bytes. |
| void internal_sha256_hash_finalize | ( | sha256_state_t * | state, |
| unsigned char * | out | ||
| ) |
Returns the final hash value from a SHA256 hashing operation.
| state | Hash state to be finalized. |
| out | Points to the output buffer to receive the 32-byte hash value. |
| void internal_sha256_hash_init | ( | sha256_state_t * | state | ) |
Initializes the state for a SHA256 hashing operation.
| state | Hash state to be initialized. |
| void internal_sha256_hash_update | ( | sha256_state_t * | state, |
| const unsigned char * | in, | ||
| size_t | inlen | ||
| ) |
Updates a SHA256 state with more input data.
| state | Hash state to be updated. |
| in | Points to the input data to be incorporated into the state. |
| inlen | Length of the input data to be incorporated into the state. |
| void internal_sha256_hmac | ( | unsigned char * | out, |
| const unsigned char * | key, | ||
| size_t | keylen, | ||
| const unsigned char * | in, | ||
| size_t | inlen | ||
| ) |
Computes a HMAC value using SHA256.
| out | Buffer to receive the output HMAC value; must be at least SHA256_HASH_SIZE bytes in length. |
| key | Points to the key. |
| keylen | Number of bytes in the key. |
| in | Points to the data to authenticate. |
| inlen | Number of bytes of data to authenticate. |
| void internal_sha256_hmac_finalize | ( | sha256_state_t * | state, |
| const unsigned char * | key, | ||
| size_t | keylen, | ||
| unsigned char * | out | ||
| ) |
Finalizes an incremental SHA256-HMAC state.
| state | HMAC state to squeeze the output data from. |
| key | Points to the key. |
| keylen | Number of bytes in the key. |
| out | Points to the output buffer to receive the HMAC value; must be at least SHA256_HASH_SIZE bytes in length. |
| void internal_sha256_hmac_init | ( | sha256_state_t * | state, |
| const unsigned char * | key, | ||
| size_t | keylen | ||
| ) |
Initializes an incremental HMAC state using SHA256.
| state | Points to the state to be initialized. |
| key | Points to the key. |
| keylen | Number of bytes in the key. |
| void internal_sha256_hmac_update | ( | sha256_state_t * | state, |
| const unsigned char * | in, | ||
| size_t | inlen | ||
| ) |
Updates an incremental SHA256-HMAC state with more input data.
| state | HMAC state to be updated. |
| in | Points to the input data to be incorporated into the state. |
| inlen | Length of the input data to be incorporated into the state. |
1.8.6