exp2l: Work around a NetBSD 10.0/i386 bug.
[gnulib.git] / lib / md2.h
blob2a1f318e1fec4676e7a684028ce770513a445213
1 /* Declarations of functions and data types used for MD2 sum
2 library functions.
3 Copyright (C) 2000-2001, 2003, 2005, 2008-2024 Free Software Foundation,
4 Inc.
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/>. */
19 #ifndef MD2_H
20 # define MD2_H 1
22 # include <stdio.h>
23 # include <stddef.h>
25 # ifdef __cplusplus
26 extern "C" {
27 # endif
29 # define MD2_DIGEST_SIZE 16
31 /* Structure to save state of computation between the single steps. */
32 struct md2_ctx
34 unsigned char chksum[16], X[48], buf[16];
35 size_t curlen;
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
44 starting at BUFFER.
45 It is NOT required that LEN is a multiple of 64. */
46 extern void md2_process_block (const void *buffer, size_t len,
47 struct md2_ctx *ctx);
49 /* Starting with the result of former calls of this function (or the
50 initialization function update the context for the next LEN bytes
51 starting at BUFFER.
52 It is NOT required that LEN is a multiple of 64. */
53 extern void md2_process_bytes (const void *buffer, size_t len,
54 struct md2_ctx *ctx);
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
72 digest. */
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);
83 # ifdef __cplusplus
85 # endif
87 #endif