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

Calculation of MD5 digest. More...

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

Go to the source code of this file.

Data Structures

struct  Md5Ctx
 

Macros

#define MD5_WORD_SIZE_BITS   32
 
#define MD5_BYTES_IN_WORD   (MD5_WORD_SIZE_BITS / 8)
 
#define MD5_HASH_SIZE_WORDS   4
 
#define MD5_DIGEST_SIZE_WORDS   MD5_HASH_SIZE_WORDS
 
#define MD5_DIGEST_SIZE   (MD5_DIGEST_SIZE_WORDS * MD5_BYTES_IN_WORD)
 
#define MD5_DIGEST_STRING_SIZE   ((MD5_DIGEST_SIZE) * 2 + 1)
 
#define MD5_BLOCK_SIZE_BITS   512
 
#define MD5_BLOCK_SIZE   (MD5_BLOCK_SIZE_BITS / 8)
 
#define MD5_BLOCK_SIZE_WORDS   (MD5_BLOCK_SIZE_BITS / MD5_WORD_SIZE_BITS)
 
#define MHD_MD5_HAS_FINISH   1
 

Functions

void MHD_MD5_init (struct Md5Ctx *ctx)
 
void MHD_MD5_update (struct Md5Ctx *ctx, const uint8_t *data, size_t length)
 
void MHD_MD5_finish (struct Md5Ctx *ctx, uint8_t digest[MD5_DIGEST_SIZE])
 

Detailed Description

Calculation of MD5 digest.

Author
Karlson2k (Evgeny Grin)

Definition in file md5.h.

Macro Definition Documentation

◆ MD5_BLOCK_SIZE

#define MD5_BLOCK_SIZE   (MD5_BLOCK_SIZE_BITS / 8)

Size of MD5 single processing block in bytes.

Definition at line 76 of file md5.h.

Referenced by MHD_MD5_finish(), and MHD_MD5_update().

◆ MD5_BLOCK_SIZE_BITS

#define MD5_BLOCK_SIZE_BITS   512

Size of MD5 single processing block in bits.

Definition at line 71 of file md5.h.

◆ MD5_BLOCK_SIZE_WORDS

#define MD5_BLOCK_SIZE_WORDS   (MD5_BLOCK_SIZE_BITS / MD5_WORD_SIZE_BITS)

Size of MD5 single processing block in words.

Definition at line 81 of file md5.h.

Referenced by MHD_MD5_finish().

◆ MD5_BYTES_IN_WORD

#define MD5_BYTES_IN_WORD   (MD5_WORD_SIZE_BITS / 8)

Number of bytes in single MD5 word.

Definition at line 43 of file md5.h.

Referenced by MHD_MD5_finish().

◆ MD5_DIGEST_SIZE

#define MD5_DIGEST_SIZE   (MD5_DIGEST_SIZE_WORDS * MD5_BYTES_IN_WORD)

Size of MD5 resulting digest in bytes This is the final digest size, not intermediate hash.

Definition at line 61 of file md5.h.

Referenced by digest_get_hash_size(), digest_get_size(), get_nonce_timestamp(), MHD_MD5_finish(), and MHD_MD5_finish_reset().

◆ MD5_DIGEST_SIZE_WORDS

#define MD5_DIGEST_SIZE_WORDS   MD5_HASH_SIZE_WORDS

Size of MD5 resulting digest in bytes. This is the final digest size, not intermediate hash.

Definition at line 55 of file md5.h.

Referenced by MHD_MD5_finish().

◆ MD5_DIGEST_STRING_SIZE

#define MD5_DIGEST_STRING_SIZE   ((MD5_DIGEST_SIZE) * 2 + 1)

Size of MD5 digest string in chars including termination NUL.

Definition at line 66 of file md5.h.

◆ MD5_HASH_SIZE_WORDS

#define MD5_HASH_SIZE_WORDS   4

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

Definition at line 49 of file md5.h.

Referenced by md5_transform().

◆ MD5_WORD_SIZE_BITS

#define MD5_WORD_SIZE_BITS   32

Number of bits in single MD5 word.

Definition at line 38 of file md5.h.

◆ MHD_MD5_HAS_FINISH

#define MHD_MD5_HAS_FINISH   1

Indicates that function MHD_MD5_finish() (without context reset) is available

Definition at line 129 of file md5.h.

Function Documentation

◆ MHD_MD5_finish()

void MHD_MD5_finish ( struct Md5Ctx * ctx,
uint8_t digest[MD5_DIGEST_SIZE] )

Finalise MD5 calculation, return digest.

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

< Number of processed bits

< Number of bytes in the context buffer

Definition at line 461 of file md5.c.

References _MHD_PUT_32BIT_LE, _MHD_PUT_64BIT_LE_SAFE(), _MHD_UINT32_ALIGN, Md5Ctx::buffer, Md5Ctx::count, Md5Ctx::H, MD5_BLOCK_SIZE, MD5_BLOCK_SIZE_WORDS, MD5_BYTES_IN_WORD, MD5_DIGEST_SIZE, MD5_DIGEST_SIZE_WORDS, MD5_SIZE_OF_LEN_ADD, and md5_transform().

Referenced by digest_calc_hash().

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

◆ MHD_MD5_init()

void MHD_MD5_init ( struct Md5Ctx * ctx)

Initialise structure for MD5 calculation.

Parameters
ctxthe calculation context

Definition at line 41 of file md5.c.

References Md5Ctx::count, and Md5Ctx::H.

◆ MHD_MD5_update()

void MHD_MD5_update ( struct Md5Ctx * ctx,
const uint8_t * data,
size_t length )

MD5 process portion of bytes.

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

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

Definition at line 393 of file md5.c.

References Md5Ctx::buffer, Md5Ctx::count, data, Md5Ctx::H, MD5_BLOCK_SIZE, md5_transform(), mhd_assert, and NULL.

Referenced by digest_update().

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