libGimbal 0.1.0
C17-Based Extended Standard Library and Cross-Language Runtime Framework
Loading...
Searching...
No Matches
gimbal_md5.h
Go to the documentation of this file.
1/*! \file
2 * \brief MD5 cryptographic hashing algorithm and API
3 * \ingroup hashing
4 *
5 * This file contains the libGimbal API providing the
6 * MD5 cryptographic hashing algorithm.
7 *
8 * \author 1990 RLR
9 * \authors 1991 SRD, AJ, BSK, JT
10 * \author 2023 Falco Girgis
11 *
12 * \copyright 1990 RSA Data Security, Inc.
13 */
14#ifndef GIMBAL_MD5_H
15#define GIMBAL_MD5_H
16
17#include "../core/gimbal_decls.h"
18
19#define GBL_MD5_DIGEST_SIZE 16
20#define GBL_MD5_DIGEST_STRING_SIZE 64
21
22#define GBL_SELF_TYPE GblMd5Context
23
25
26/*! Data structure for MD5 (Message-Digest) computation
27 * \ingroup hashing
28 */
29typedef struct GblMd5Context {
30 uint32_t i[2]; //!< Number of _bits_ handled mod 2^64
31 uint32_t buf[4]; //!< Scratch buffer
32 uint8_t in[64]; //!< Input buffer
33} GblMd5Context;
34
35/*! \name Incremental hashing
36 * \brief Methods for operating on an MD5 context
37 * \relatesalso GblMd5context
38 * @{
39 */
40//! Initializes the given MD5 context
41GBL_EXPORT void GblMd5_init (GBL_SELF) GBL_NOEXCEPT;
42//! Adds the data in \p pData of \p bytes length to the running MD5 hash context
43GBL_EXPORT void GblMd5_update (GBL_SELF, const void* pData, size_t bytes) GBL_NOEXCEPT;
44//! Finalizes the running MD5 hash context, returning its digest
45GBL_EXPORT void GblMd5_final (GBL_SELF, uint8_t digest[GBL_MD5_DIGEST_SIZE]) GBL_NOEXCEPT;
46//! @}
47
48//! Returns the display-friendly hexadecimal form of the given digest, with each 32-bit word separated by a space
49GBL_EXPORT const char* GblMd5_string (const uint8_t digest[GBL_MD5_DIGEST_SIZE],
51
53
54#undef GBL_SELF_TYPE
55
56#endif // GIMBAL_MD5_H
#define GBL_NOEXCEPT
#define GBL_DECLS_BEGIN
#define GBL_EXPORT
#define GBL_MD5_DIGEST_SIZE
Definition gimbal_md5.h:19
#define GBL_MD5_DIGEST_STRING_SIZE
Definition gimbal_md5.h:20
Data structure for MD5 (Message-Digest) computation.
Definition gimbal_md5.h:29
uint8_t in[64]
Input buffer.
Definition gimbal_md5.h:32
uint32_t i[2]
Number of bits handled mod 2^64.
Definition gimbal_md5.h:30
uint32_t buf[4]
Scratch buffer.
Definition gimbal_md5.h:31