1 /* Declarations of functions and data types used for MD2 sum
3 Copyright (C) 2000-2001, 2003, 2005, 2008-2024 Free Software Foundation,
6 This file is free software: you can redistribute it and/or modify
7 it under the terms of the GNU Lesser General Public License as
8 published by the Free Software Foundation; either version 2.1 of the
9 License, or (at your option) any later version.
11 This file is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU Lesser General Public License for more details.
16 You should have received a copy of the GNU Lesser General Public License
17 along with this program. If not, see <https://www.gnu.org/licenses/>. */
29 # define MD2_DIGEST_SIZE 16
31 /* Structure to save state of computation between the single steps. */
34 unsigned char chksum
[16], X
[48], buf
[16];
39 /* Initialize structure containing state of computation. */
40 extern void md2_init_ctx (struct md2_ctx
*ctx
);
42 /* Starting with the result of former calls of this function (or the
43 initialization function update the context for the next LEN bytes
45 It is NOT required that LEN is a multiple of 64. */
46 extern void md2_process_block (const void *buffer
, size_t len
,
49 /* Starting with the result of former calls of this function (or the
50 initialization function update the context for the next LEN bytes
52 It is NOT required that LEN is a multiple of 64. */
53 extern void md2_process_bytes (const void *buffer
, size_t len
,
56 /* Process the remaining bytes in the buffer and put result from CTX
57 in first 16 bytes following RESBUF. The result is always in little
58 endian byte order, so that a byte-wise output yields to the wanted
59 ASCII representation of the message digest. */
60 extern void *md2_finish_ctx (struct md2_ctx
*ctx
, void *restrict resbuf
);
63 /* Put result from CTX in first 16 bytes following RESBUF. The result is
64 always in little endian byte order, so that a byte-wise output yields
65 to the wanted ASCII representation of the message digest. */
66 extern void *md2_read_ctx (const struct md2_ctx
*ctx
, void *restrict resbuf
);
69 /* Compute MD2 message digest for LEN bytes beginning at BUFFER. The
70 result is always in little endian byte order, so that a byte-wise
71 output yields to the wanted ASCII representation of the message
73 extern void *md2_buffer (const char *buffer
, size_t len
,
74 void *restrict resblock
);
77 /* Compute MD2 message digest for bytes read from STREAM. The
78 resulting message digest number will be written into the 16 bytes
79 beginning at RESBLOCK. */
80 extern int md2_stream (FILE *stream
, void *resblock
);