1 /* Declarations of functions and data types used for MD2 sum
3 Copyright (C) 2000-2001, 2003, 2005, 2008-2018 Free Software Foundation,
6 This program is free software; you can redistribute it and/or modify it
7 under the terms of the GNU General Public License as published by the
8 Free Software Foundation; either version 2, or (at your option) any
11 This program 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 General Public License for more details.
16 You should have received a copy of the GNU 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 *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 *resbuf
);
69 /* Compute MD2 message digest for bytes read from STREAM. The
70 resulting message digest number will be written into the 16 bytes
71 beginning at RESBLOCK. */
72 extern int md2_stream (FILE *stream
, void *resblock
);
74 /* Compute MD2 message digest for LEN bytes beginning at BUFFER. The
75 result is always in little endian byte order, so that a byte-wise
76 output yields to the wanted ASCII representation of the message
78 extern void *md2_buffer (const char *buffer
, size_t len
, void *resblock
);