GNU libmicrohttpd 0.9.77
Loading...
Searching...
No Matches
sha1.h File Reference

Calculation of SHA-1 digest. More...

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

Go to the source code of this file.

Data Structures

struct  sha1_ctx
 

Macros

#define _SHA1_DIGEST_LENGTH   5
 
#define SHA1_WORD_SIZE_BITS   32
 
#define SHA1_BYTES_IN_WORD   (SHA1_WORD_SIZE_BITS / 8)
 
#define SHA1_DIGEST_SIZE   (_SHA1_DIGEST_LENGTH * SHA1_BYTES_IN_WORD)
 
#define SHA1_DIGEST_STRING_SIZE   ((SHA1_DIGEST_SIZE) * 2 + 1)
 
#define SHA1_BLOCK_SIZE_BITS   512
 
#define SHA1_BLOCK_SIZE   (SHA1_BLOCK_SIZE_BITS / 8)
 

Functions

void MHD_SHA1_init (void *ctx_)
 
void MHD_SHA1_update (void *ctx_, const uint8_t *data, size_t length)
 
void MHD_SHA1_finish (void *ctx_, uint8_t digest[SHA1_DIGEST_SIZE])
 

Detailed Description

Calculation of SHA-1 digest.

Author
Karlson2k (Evgeny Grin)

Definition in file sha1.h.

Macro Definition Documentation

◆ _SHA1_DIGEST_LENGTH

#define _SHA1_DIGEST_LENGTH   5

SHA-1 digest is kept internally as 5 32-bit words.

Definition at line 38 of file sha1.h.

◆ SHA1_BLOCK_SIZE

#define SHA1_BLOCK_SIZE   (SHA1_BLOCK_SIZE_BITS / 8)

Size of single processing block in bytes

Definition at line 68 of file sha1.h.

◆ SHA1_BLOCK_SIZE_BITS

#define SHA1_BLOCK_SIZE_BITS   512

Size of single processing block in bits

Definition at line 63 of file sha1.h.

◆ SHA1_BYTES_IN_WORD

#define SHA1_BYTES_IN_WORD   (SHA1_WORD_SIZE_BITS / 8)

Number of bytes in single SHA-1 word

Definition at line 48 of file sha1.h.

◆ SHA1_DIGEST_SIZE

#define SHA1_DIGEST_SIZE   (_SHA1_DIGEST_LENGTH * SHA1_BYTES_IN_WORD)

Size of SHA-1 digest in bytes

Definition at line 53 of file sha1.h.

◆ SHA1_DIGEST_STRING_SIZE

#define SHA1_DIGEST_STRING_SIZE   ((SHA1_DIGEST_SIZE) * 2 + 1)

Size of SHA-1 digest string in chars including termination NUL

Definition at line 58 of file sha1.h.

◆ SHA1_WORD_SIZE_BITS

#define SHA1_WORD_SIZE_BITS   32

Number of bits in single SHA-1 word

Definition at line 43 of file sha1.h.

Function Documentation

◆ MHD_SHA1_finish()

void MHD_SHA1_finish ( void *  ctx_,
uint8_t  digest[SHA1_DIGEST_SIZE] 
)

Finalise SHA-1 calculation, return digest.

Parameters
ctx_must be a struct sha1_ctx *
[out]digestset to the hash, must be SHA1_DIGEST_SIZE bytes

< Number of processed bits

< Number of bytes in buffer

< Number of processed bits

< Number of bytes in buffer

Definition at line 311 of file sha1.c.

◆ MHD_SHA1_init()

void MHD_SHA1_init ( void *  ctx_)

Initialise structure for SHA-1 calculation.

Parameters
ctxmust be a struct sha1_ctx *

Initialise structure for SHA-1 calculation.

Parameters
ctx_must be a struct sha1_ctx *

Definition at line 41 of file sha1.c.

◆ MHD_SHA1_update()

void MHD_SHA1_update ( void *  ctx_,
const uint8_t *  data,
size_t  length 
)

Process portion of bytes.

Parameters
ctx_must be a struct sha1_ctx *
databytes to add to hash
lengthnumber of bytes in data

< Number of bytes in buffer

< Number of bytes in buffer

Definition at line 249 of file sha1.c.