Software implementation of the SHA256 algorithm.
Macros | |
#define | rotate_right(value, places) ((value >> places) | (value << (32 - places))) |
Functions | |
void | sw_sha256 (const uint8_t *message, unsigned int len, uint8_t digest[SHA256_DIGEST_SIZE]) |
single call convenience function which computes Hash of given data using SHA256 software More... | |
void | sw_sha256_final (sw_sha256_ctx *ctx, uint8_t digest[SHA256_DIGEST_SIZE]) |
completes the final SHA256 calculation and returns the final digest/hash More... | |
void | sw_sha256_init (sw_sha256_ctx *ctx) |
Intialize the software SHA256. More... | |
static void | sw_sha256_process (sw_sha256_ctx *ctx, const uint8_t *blocks, uint32_t block_count) |
Processes whole blocks (64 bytes) of data. More... | |
void | sw_sha256_update (sw_sha256_ctx *ctx, const uint8_t *msg, uint32_t msg_size) |
updates the running hash with the next block of data, called iteratively for the entire stream of data to be hashed using the SHA256 software More... | |
#define rotate_right | ( | value, | |
places | |||
) | ((value >> places) | (value << (32 - places))) |
Referenced by sw_sha256_process().
void sw_sha256 | ( | const uint8_t * | message, |
unsigned int | len, | ||
uint8_t | digest[SHA256_DIGEST_SIZE] | ||
) |
single call convenience function which computes Hash of given data using SHA256 software
[in] | message | pointer to stream of data to hash |
[in] | len | size of data stream to hash |
[out] | digest | result |
References sw_sha256_final(), sw_sha256_init(), and sw_sha256_update().
void sw_sha256_final | ( | sw_sha256_ctx * | ctx, |
uint8_t | digest[SHA256_DIGEST_SIZE] | ||
) |
completes the final SHA256 calculation and returns the final digest/hash
[in] | ctx | ptr to context data structure |
[out] | digest | receives the computed digest of the SHA 256 |
References sw_sha256_ctx::block, sw_sha256_ctx::block_size, sw_sha256_ctx::hash, i, j, SHA256_BLOCK_SIZE, sw_sha256_process(), and sw_sha256_ctx::total_msg_size.
Referenced by atcac_sw_sha2_256_finish(), and sw_sha256().
void sw_sha256_init | ( | sw_sha256_ctx * | ctx | ) |
Intialize the software SHA256.
[in] | ctx | SHA256 hash context |
References sw_sha256_ctx::hash, and i.
Referenced by atcac_sw_sha2_256_init(), and sw_sha256().
|
static |
Processes whole blocks (64 bytes) of data.
[in] | ctx | SHA256 hash context |
[in] | blocks | Raw blocks to be processed |
[in] | block_count | Number of 64-byte blocks to process |
References sw_sha256_ctx::hash, i, rotate_right, and SHA256_BLOCK_SIZE.
Referenced by sw_sha256_final(), and sw_sha256_update().
void sw_sha256_update | ( | sw_sha256_ctx * | ctx, |
const uint8_t * | msg, | ||
uint32_t | msg_size | ||
) |
updates the running hash with the next block of data, called iteratively for the entire stream of data to be hashed using the SHA256 software
[in] | ctx | SHA256 hash context |
[in] | msg | Raw blocks to be processed |
[in] | msg_size | The size of the message passed |
References sw_sha256_ctx::block, sw_sha256_ctx::block_size, SHA256_BLOCK_SIZE, sw_sha256_process(), and sw_sha256_ctx::total_msg_size.
Referenced by atcac_sw_sha2_256_update(), and sw_sha256().