GNU libmicrohttpd 1.0.1
Loading...
Searching...
No Matches
sha512_256.h File Reference

Calculation of SHA-512/256 digest. More...

#include "mhd_options.h"
#include <stdint.h>
Include dependency graph for sha512_256.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  Sha512_256Ctx
 

Macros

#define SHA512_256_WORD_SIZE_BITS   64
 
#define SHA512_256_BYTES_IN_WORD   (SHA512_256_WORD_SIZE_BITS / 8)
 
#define SHA512_256_HASH_SIZE_WORDS   8
 
#define SHA512_256_DIGEST_SIZE_WORDS   (SHA512_256_HASH_SIZE_WORDS / 2)
 
#define SHA512_256_DIGEST_SIZE    (SHA512_256_DIGEST_SIZE_WORDS * SHA512_256_BYTES_IN_WORD)
 
#define SHA512_256_DIGEST_STRING_SIZE   ((SHA512_256_DIGEST_SIZE) * 2 + 1)
 
#define SHA512_256_BLOCK_SIZE_BITS   1024
 
#define SHA512_256_BLOCK_SIZE   (SHA512_256_BLOCK_SIZE_BITS / 8)
 
#define SHA512_256_BLOCK_SIZE_WORDS    (SHA512_256_BLOCK_SIZE_BITS / SHA512_256_WORD_SIZE_BITS)
 

Functions

void MHD_SHA512_256_init (struct Sha512_256Ctx *ctx)
 
void MHD_SHA512_256_update (struct Sha512_256Ctx *ctx, const uint8_t *data, size_t length)
 
void MHD_SHA512_256_finish (struct Sha512_256Ctx *ctx, uint8_t digest[SHA512_256_DIGEST_SIZE])
 

Detailed Description

Calculation of SHA-512/256 digest.

Author
Karlson2k (Evgeny Grin)

Definition in file sha512_256.h.

Macro Definition Documentation

◆ SHA512_256_BLOCK_SIZE

#define SHA512_256_BLOCK_SIZE   (SHA512_256_BLOCK_SIZE_BITS / 8)

Size of SHA-512/256 single processing block in bytes.

Definition at line 78 of file sha512_256.h.

◆ SHA512_256_BLOCK_SIZE_BITS

#define SHA512_256_BLOCK_SIZE_BITS   1024

Size of SHA-512/256 single processing block in bits.

Definition at line 73 of file sha512_256.h.

◆ SHA512_256_BLOCK_SIZE_WORDS

#define SHA512_256_BLOCK_SIZE_WORDS    (SHA512_256_BLOCK_SIZE_BITS / SHA512_256_WORD_SIZE_BITS)

Size of SHA-512/256 single processing block in words.

Definition at line 83 of file sha512_256.h.

◆ SHA512_256_BYTES_IN_WORD

#define SHA512_256_BYTES_IN_WORD   (SHA512_256_WORD_SIZE_BITS / 8)

Number of bytes in single SHA-512/256 word.

Definition at line 44 of file sha512_256.h.

◆ SHA512_256_DIGEST_SIZE

#define SHA512_256_DIGEST_SIZE    (SHA512_256_DIGEST_SIZE_WORDS * SHA512_256_BYTES_IN_WORD)

Size of SHA-512/256 resulting digest in bytes This is the final digest size, not intermediate hash.

Definition at line 62 of file sha512_256.h.

◆ SHA512_256_DIGEST_SIZE_WORDS

#define SHA512_256_DIGEST_SIZE_WORDS   (SHA512_256_HASH_SIZE_WORDS / 2)

Size of SHA-512/256 resulting digest in bytes. This is the final digest size, not intermediate hash.

Definition at line 56 of file sha512_256.h.

◆ SHA512_256_DIGEST_STRING_SIZE

#define SHA512_256_DIGEST_STRING_SIZE   ((SHA512_256_DIGEST_SIZE) * 2 + 1)

Size of SHA-512/256 digest string in chars including termination NUL.

Definition at line 68 of file sha512_256.h.

◆ SHA512_256_HASH_SIZE_WORDS

#define SHA512_256_HASH_SIZE_WORDS   8

Hash is kept internally as 8 64-bit words. This is intermediate hash size, used during computing the final digest.

Definition at line 50 of file sha512_256.h.

◆ SHA512_256_WORD_SIZE_BITS

#define SHA512_256_WORD_SIZE_BITS   64

Number of bits in single SHA-512/256 word.

Definition at line 39 of file sha512_256.h.

Function Documentation

◆ MHD_SHA512_256_finish()

void MHD_SHA512_256_finish ( struct Sha512_256Ctx ctx,
uint8_t  digest[SHA512_256_DIGEST_SIZE] 
)

Finalise SHA-512/256 calculation, return digest.

Parameters
ctxthe calculation context
[out]digestset to the hash, must be SHA512_256_DIGEST_SIZE bytes

< Number of processed bits

< Number of bytes in the context buffer

Definition at line 539 of file sha512_256.c.

References _MHD_PUT_64BIT_BE, _MHD_UINT64_ALIGN, Sha512_256Ctx::buffer, Sha512_256Ctx::count, Sha512_256Ctx::count_bits_hi, Sha512_256Ctx::H, SHA512_256_BLOCK_SIZE, SHA512_256_BLOCK_SIZE_WORDS, SHA512_256_BYTES_IN_WORD, SHA512_256_DIGEST_SIZE, SHA512_256_DIGEST_SIZE_WORDS, SHA512_256_SIZE_OF_LEN_ADD, and sha512_256_transform().

Referenced by digest_calc_hash().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ MHD_SHA512_256_init()

void MHD_SHA512_256_init ( struct Sha512_256Ctx ctx)

Initialise structure for SHA-512/256 calculation.

Parameters
ctxthe calculation context

Definition at line 41 of file sha512_256.c.

References Sha512_256Ctx::count, Sha512_256Ctx::count_bits_hi, and Sha512_256Ctx::H.

Referenced by digest_init_one_time(), and digest_reset().

Here is the caller graph for this function:

◆ MHD_SHA512_256_update()

void MHD_SHA512_256_update ( struct Sha512_256Ctx ctx,
const uint8_t *  data,
size_t  length 
)

Process portion of bytes.

Parameters
ctxthe calculation context
databytes to add to hash
lengthnumber of bytes in data

< Number of bytes in the context buffer

< The high part to be moved to another variable

Definition at line 460 of file sha512_256.c.

References Sha512_256Ctx::buffer, Sha512_256Ctx::count, Sha512_256Ctx::count_bits_hi, data, Sha512_256Ctx::H, mhd_assert, NULL, SHA512_256_BLOCK_SIZE, and sha512_256_transform().

Referenced by digest_update().

Here is the call graph for this function:
Here is the caller graph for this function: