md5.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2003-2005 by Christopher R. Hertel
3  * 2015 Freie Universität Berlin
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2.1 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  * Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public
16  * License along with this library; if not, write to the Free Software
17  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18  */
19 
54 #ifndef HASHES_MD5_H
55 #define HASHES_MD5_H
56 
57 #include <stdint.h>
58 #include <string.h>
59 
60 #ifdef __cplusplus
61 extern "C" {
62 #endif
63 
67 #define MD5_DIGEST_LENGTH (16U)
68 
72 typedef struct {
73  uint32_t len;
74  uint32_t abcd[4];
75  int b_used;
76  uint8_t block[64];
77 } md5_ctx_t;
78 
95 void md5_init(md5_ctx_t *ctx);
96 
104 void md5_update(md5_ctx_t *ctx, const void *data, size_t len);
105 
112 void md5_final(md5_ctx_t *ctx, void *digest);
113 
121 void md5(void *digest, const void *data, size_t len);
122 
123 #ifdef __cplusplus
124 }
125 #endif
126 
127 #endif /* HASHES_MD5_H */
128 
md5_final
void md5_final(md5_ctx_t *ctx, void *digest)
Finish up the current MD5 hash calculation generate the final hash.
md5_ctx_t
MD5 calculation context.
Definition: md5.h:72
md5
void md5(void *digest, const void *data, size_t len)
Calculate a MD5 hash from the given data.
md5_ctx_t::b_used
int b_used
number of bytes used in the current block
Definition: md5.h:75
md5_init
void md5_init(md5_ctx_t *ctx)
Initialize the MD5 calculation context.
md5_update
void md5_update(md5_ctx_t *ctx, const void *data, size_t len)
Build an MD5 Message Digest within the given context.
md5_ctx_t::len
uint32_t len
overall number of bytes processed
Definition: md5.h:73