Software implementation of the SHA256 algorithm.
#include <stdint.h>
Data Structures | |
struct | sw_sha256_ctx |
Macros | |
#define | SHA256_BLOCK_SIZE (64) |
#define | SHA256_DIGEST_SIZE (32) |
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... | |
void | sw_sha256_update (sw_sha256_ctx *ctx, const uint8_t *message, uint32_t len) |
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 SHA256_BLOCK_SIZE (64) |
Referenced by sw_sha256_final(), sw_sha256_process(), and sw_sha256_update().
#define SHA256_DIGEST_SIZE (32) |
Referenced by SHA256_HashSW().
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().
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().