libhasha 2.2.2
Loading...
Searching...
No Matches
md5.h File Reference

Header file for the MD5 cryptographic hash function. More...

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.

Classes

struct  ha_md5_context
 Context structure for MD5 hashing. More...

Macros

#define HA_MD5_BLOCK_SIZE   64
 Block size (in bytes) for the MD5 algorithm.
#define HA_MD5_DIGEST_SIZE   ha_bB(128)
 Digest size (in bytes) for the MD5 algorithm (128 bits).

Typedefs

typedef struct ha_md5_context ha_md5_context

Functions

HA_PUBFUN void ha_md5_init (ha_md5_context *ctx)
 Initializes the MD5 context.
HA_PUBFUN void ha_md5_update (ha_md5_context *ctx, ha_inbuf_t data, size_t len)
 Updates the MD5 context with new data.
HA_PUBFUN void ha_md5_final (ha_md5_context *ctx, ha_digest_t digest)
 Finalizes the MD5 computation and produces the hash digest.
HA_PUBFUN void ha_md5_hash (ha_inbuf_t data, size_t len, ha_digest_t digest)
 Computes the MD5 hash in a one-shot operation.

Detailed Description

Header file for the MD5 cryptographic hash function.

This header file defines the interface for computing the MD5 hash, a widely-used cryptographic hash algorithm that produces a 128-bit (16-byte) digest. The MD5 algorithm processes data in 512-bit blocks and is commonly used for checksum calculations and data integrity verification.

Note
MD5 is considered cryptographically broken and unsuitable for secure applications. It is provided primarily for legacy support and non-critical usage scenarios.
See also
https://en.wikipedia.org/wiki/MD5 for further details on the MD5 algorithm.

Definition in file md5.h.

Macro Definition Documentation

◆ HA_MD5_BLOCK_SIZE

#define HA_MD5_BLOCK_SIZE   64

Block size (in bytes) for the MD5 algorithm.

Definition at line 28 of file md5.h.

◆ HA_MD5_DIGEST_SIZE

#define HA_MD5_DIGEST_SIZE   ha_bB(128)

Digest size (in bytes) for the MD5 algorithm (128 bits).

Definition at line 34 of file md5.h.

Typedef Documentation

◆ ha_md5_context

typedef struct ha_md5_context ha_md5_context

Function Documentation

◆ ha_md5_final()

HA_PUBFUN void ha_md5_final ( ha_md5_context * ctx,
ha_digest_t digest )

Finalizes the MD5 computation and produces the hash digest.

This function finals the MD5 hash calculation and outputs the resulting digest into the provided buffer.

Parameters
ctxPointer to the MD5 context structure.
digestPointer to the output buffer to store the final MD5 digest (16 bytes).

◆ ha_md5_hash()

HA_PUBFUN void ha_md5_hash ( ha_inbuf_t data,
size_t len,
ha_digest_t digest )

Computes the MD5 hash in a one-shot operation.

This function computes the MD5 hash of the provided data in a single call. It initializes, updates, and finals the MD5 computation internally.

Parameters
dataPointer to the input data to process.
lenLength of the input data in bytes.
digestPointer to the output buffer to store the final MD5 digest (16 bytes).

◆ ha_md5_init()

HA_PUBFUN void ha_md5_init ( ha_md5_context * ctx)

Initializes the MD5 context.

This function initializes the MD5 context to start a new hash computation.

Parameters
ctxPointer to the MD5 context structure to initialize.

◆ ha_md5_update()

HA_PUBFUN void ha_md5_update ( ha_md5_context * ctx,
ha_inbuf_t data,
size_t len )

Updates the MD5 context with new data.

This function processes the provided data and updates the MD5 context state.

Parameters
ctxPointer to the MD5 context structure.
dataPointer to the input data to process.
lenLength of the input data in bytes.