GNU libmicrohttpd 1.0.1
|
Calculation of SHA-256 digest. More...
Go to the source code of this file.
Data Structures | |
struct | Sha256Ctx |
Macros | |
#define | SHA256_DIGEST_SIZE_WORDS 8 |
#define | SHA256_WORD_SIZE_BITS 32 |
#define | SHA256_BYTES_IN_WORD (SHA256_WORD_SIZE_BITS / 8) |
#define | SHA256_DIGEST_SIZE (SHA256_DIGEST_SIZE_WORDS * SHA256_BYTES_IN_WORD) |
#define | SHA256_DIGEST_STRING_SIZE ((SHA256_DIGEST_SIZE) * 2 + 1) |
#define | SHA256_BLOCK_SIZE_BITS 512 |
#define | SHA256_BLOCK_SIZE (SHA256_BLOCK_SIZE_BITS / 8) |
#define | SHA256_BLOCK_SIZE_WORDS (SHA256_BLOCK_SIZE_BITS / SHA256_WORD_SIZE_BITS) |
#define | MHD_SHA256_HAS_FINISH 1 |
Functions | |
void | MHD_SHA256_init (struct Sha256Ctx *ctx) |
void | MHD_SHA256_update (struct Sha256Ctx *ctx, const uint8_t *data, size_t length) |
void | MHD_SHA256_finish (struct Sha256Ctx *ctx, uint8_t digest[SHA256_DIGEST_SIZE]) |
Calculation of SHA-256 digest.
Definition in file sha256.h.
#define MHD_SHA256_HAS_FINISH 1 |
Indicates that function MHD_SHA256_finish() (without context reset) is available
#define SHA256_BLOCK_SIZE (SHA256_BLOCK_SIZE_BITS / 8) |
Size of single processing block in bytes
Definition at line 70 of file sha256.h.
Referenced by MHD_SHA256_finish(), MHD_SHA256_update(), and sha256_transform().
#define SHA256_BLOCK_SIZE_BITS 512 |
#define SHA256_BLOCK_SIZE_WORDS (SHA256_BLOCK_SIZE_BITS / SHA256_WORD_SIZE_BITS) |
Size of single processing block in bytes
Definition at line 75 of file sha256.h.
Referenced by MHD_SHA256_finish().
#define SHA256_BYTES_IN_WORD (SHA256_WORD_SIZE_BITS / 8) |
Number of bytes in single SHA-256 word used to process data
Definition at line 50 of file sha256.h.
Referenced by MHD_SHA256_finish().
#define SHA256_DIGEST_SIZE (SHA256_DIGEST_SIZE_WORDS * SHA256_BYTES_IN_WORD) |
Size of SHA-256 digest in bytes
Definition at line 55 of file sha256.h.
Referenced by digest_get_hash_size(), digest_get_size(), and MHD_SHA256_finish().
#define SHA256_DIGEST_SIZE_WORDS 8 |
Digest is kept internally as 8 32-bit words.
Definition at line 39 of file sha256.h.
Referenced by MHD_SHA256_finish().
#define SHA256_DIGEST_STRING_SIZE ((SHA256_DIGEST_SIZE) * 2 + 1) |
#define SHA256_WORD_SIZE_BITS 32 |
void MHD_SHA256_finish | ( | struct Sha256Ctx * | ctx, |
uint8_t | digest[SHA256_DIGEST_SIZE] ) |
Finalise SHA256 calculation, return digest.
ctx | must be a struct Sha256Ctx * | |
[out] | digest | set to the hash, must be SHA256_DIGEST_SIZE bytes |
Finalise SHA256 calculation, return digest.
ctx_ | must be a struct Sha256Ctx * | |
[out] | digest | set to the hash, must be SHA256_DIGEST_SIZE bytes |
< Number of processed bits
< Number of bytes in buffer
Definition at line 473 of file sha256.c.
References _MHD_PUT_32BIT_BE, _MHD_PUT_64BIT_BE_SAFE(), _MHD_UINT32_ALIGN, Sha256Ctx::buffer, Sha256Ctx::count, Sha256Ctx::H, SHA256_BLOCK_SIZE, SHA256_BLOCK_SIZE_WORDS, SHA256_BYTES_IN_WORD, SHA256_DIGEST_SIZE, SHA256_DIGEST_SIZE_WORDS, SHA256_SIZE_OF_LEN_ADD, and sha256_transform().
Referenced by digest_calc_hash().
void MHD_SHA256_init | ( | struct Sha256Ctx * | ctx | ) |
Initialise structure for SHA256 calculation.
ctx | must be a struct Sha256Ctx * |
Definition at line 41 of file sha256.c.
References Sha256Ctx::count, and Sha256Ctx::H.
void MHD_SHA256_update | ( | struct Sha256Ctx * | ctx, |
const uint8_t * | data, | ||
size_t | length ) |
Process portion of bytes.
ctx | must be a struct Sha256Ctx * |
data | bytes to add to hash |
length | number of bytes in data |
Process portion of bytes.
ctx_ | must be a struct Sha256Ctx * |
data | bytes to add to hash |
length | number of bytes in data |
< Number of bytes in buffer
Definition at line 410 of file sha256.c.
References Sha256Ctx::buffer, Sha256Ctx::count, data, Sha256Ctx::H, mhd_assert, NULL, SHA256_BLOCK_SIZE, and sha256_transform().
Referenced by digest_update().