unicase/locale-language: Fix link dependencies.
[gnulib.git] / lib / md2.h
blob5bba9da8ca0ea029749fbdbc841e8862ce87d0ad
1 /* Declarations of functions and data types used for MD2 sum
2 library functions.
3 Copyright (C) 2000-2001, 2003, 2005, 2008-2017 Free Software Foundation,
4 Inc.
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
9 later version.
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 <http://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 *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
77 digest. */
78 extern void *md2_buffer (const char *buffer, size_t len, void *resblock);
80 # ifdef __cplusplus
82 # endif
84 #endif