Implementation of common functionality for SHA-224/256 hashing functions. More...
Implementation of common functionality for SHA-224/256 hashing functions.
Files | |
file | sha2xx_common.h |
Common definitions for the SHA-224/256 hash functions. | |
Data Structures | |
struct | sha2xx_context_t |
Structure to hold the SHA-2XX context. More... | |
Functions | |
void | sha2xx_pad (sha2xx_context_t *ctx) |
SHA-2XX initialization. More... | |
void | sha2xx_update (sha2xx_context_t *ctx, const void *data, size_t len) |
Add bytes into the hash. More... | |
void | sha2xx_final (sha2xx_context_t *ctx, void *digest, size_t dig_len) |
SHA-2XX finalization. More... | |
Variables | |
static const uint32_t | K [64] |
SHA-224 and SHA-256 Constants. More... | |
#define | Ch(x, y, z) ((x & (y ^ z)) ^ z) |
Elementary functions used by SHA2XX. | |
#define | Maj(x, y, z) ((x & (y | z)) | (y & z)) |
#define | SHR(x, n) (x >> n) |
#define | ROTR(x, n) ((x >> n) | (x << (32 - n))) |
#define | S0(x) (ROTR(x, 2) ^ ROTR(x, 13) ^ ROTR(x, 22)) |
#define | S1(x) (ROTR(x, 6) ^ ROTR(x, 11) ^ ROTR(x, 25)) |
#define | s0(x) (ROTR(x, 7) ^ ROTR(x, 18) ^ SHR(x, 3)) |
#define | s1(x) (ROTR(x, 17) ^ ROTR(x, 19) ^ SHR(x, 10)) |
void sha2xx_final | ( | sha2xx_context_t * | ctx, |
void * | digest, | ||
size_t | dig_len | ||
) |
SHA-2XX finalization.
Pads the input data, exports the hash value, and clears the context state.
ctx | sha2xx_context_t handle to use |
digest | resulting digest, this is the hash of all the bytes |
dig_len | Length of digest |
void sha2xx_pad | ( | sha2xx_context_t * | ctx | ) |
void sha2xx_update | ( | sha2xx_context_t * | ctx, |
const void * | data, | ||
size_t | len | ||
) |
Add bytes into the hash.
ctx | sha2xx_context_t handle to use | |
[in] | data | Input data |
[in] | len | Length of data |
|
static |
SHA-224 and SHA-256 Constants.
Definition at line 87 of file sha2xx_common.h.