md5.h
Go to the documentation of this file.
1 /*
2  * SPDX-FileCopyrightText: 2003-2005 by Christopher R. Hertel
3  * SPDX-FileCopyrightText: 2015 Freie Universität Berlin
4  * SPDX-License-Identifier: LGPL-2.1-or-later
5  */
6 
7 #pragma once
8 
43 #include <stdint.h>
44 #include <string.h>
45 
46 #ifdef __cplusplus
47 extern "C" {
48 #endif
49 
53 #define MD5_DIGEST_LENGTH (16U)
54 
58 typedef struct {
59  uint32_t len;
60  uint32_t abcd[4];
61  int b_used;
62  uint8_t block[64];
63 } md5_ctx_t;
64 
81 void md5_init(md5_ctx_t *ctx);
82 
90 void md5_update(md5_ctx_t *ctx, const void *data, size_t len);
91 
98 void md5_final(md5_ctx_t *ctx, void *digest);
99 
107 void md5(void *digest, const void *data, size_t len);
108 
109 #ifdef __cplusplus
110 }
111 #endif
112 
void md5(void *digest, const void *data, size_t len)
Calculate a MD5 hash from the given data.
void md5_init(md5_ctx_t *ctx)
Initialize the MD5 calculation context.
void md5_update(md5_ctx_t *ctx, const void *data, size_t len)
Build an MD5 Message Digest within the given context.
void md5_final(md5_ctx_t *ctx, void *digest)
Finish up the current MD5 hash calculation generate the final hash.
MD5 calculation context.
Definition: md5.h:58
uint32_t len
overall number of bytes processed
Definition: md5.h:59
int b_used
number of bytes used in the current block
Definition: md5.h:61