forked from besser82/libxcrypt
-
Notifications
You must be signed in to change notification settings - Fork 0
/
alg-md5.h
52 lines (41 loc) · 1.84 KB
/
alg-md5.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
/* Declaration of functions and data types used for MD5 sum computing
library functions.
Copyright (C) 1995-2017 Free Software Foundation, Inc.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public License
as published by the Free Software Foundation; either version 2.1 of
the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, see
<https://www.gnu.org/licenses/>. */
#ifndef _CRYPT_ALG_MD5_H
#define _CRYPT_ALG_MD5_H 1
/* Structure to save state of computation between the single steps. */
struct md5_ctx
{
uint32_t A;
uint32_t B;
uint32_t C;
uint32_t D;
uint64_t total;
uint32_t buflen;
uint32_t correct_words[16];
unsigned char buffer[128];
};
/* Initialize structure containing state of computation.
(RFC 1321, 3.3: Step 3) */
extern void md5_init_ctx (struct md5_ctx *ctx);
/* Starting with the result of former calls of this function (or the
initialization function) update the context for the next LEN bytes
starting at BUFFER. LEN does not need to be a multiple of 64. */
extern void md5_process_bytes (const void *buffer, size_t len,
struct md5_ctx *ctx);
/* Process the remaining bytes in the buffer and write the finalized
hash to RESBUF, which should point to 16 bytes of storage. All
data written to CTX is erased before returning from the function. */
extern void *md5_finish_ctx (struct md5_ctx *ctx, void *resbuf);
#endif /* alg-md5.h */