Document not_eol and remove mention of regex.c.
[gnulib.git] / lib / md2.h
1 /* Declarations of functions and data types used for MD2 sum
2    library functions.
3    Copyright (C) 2000, 2001, 2003, 2005, 2008, 2009, 2010 Free Software
4    Foundation, Inc.
5
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.
10
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.
15
16    You should have received a copy of the GNU General Public License
17    along with this program; if not, write to the Free Software Foundation,
18    Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
19
20 #ifndef MD2_H
21 # define MD2_H 1
22
23 # include <stdio.h>
24 # include <stddef.h>
25
26 # ifdef __cplusplus
27 extern "C" {
28 # endif
29
30 # define MD2_DIGEST_SIZE 16
31
32 /* Structure to save state of computation between the single steps.  */
33 struct md2_ctx
34 {
35   unsigned char chksum[16], X[48], buf[16];
36   size_t curlen;
37 };
38
39
40 /* Initialize structure containing state of computation. */
41 extern void md2_init_ctx (struct md2_ctx *ctx);
42
43 /* Starting with the result of former calls of this function (or the
44    initialization function update the context for the next LEN bytes
45    starting at BUFFER.
46    It is NOT required that LEN is a multiple of 64.  */
47 extern void md2_process_block (const void *buffer, size_t len,
48                                struct md2_ctx *ctx);
49
50 /* Starting with the result of former calls of this function (or the
51    initialization function update the context for the next LEN bytes
52    starting at BUFFER.
53    It is NOT required that LEN is a multiple of 64.  */
54 extern void md2_process_bytes (const void *buffer, size_t len,
55                                struct md2_ctx *ctx);
56
57 /* Process the remaining bytes in the buffer and put result from CTX
58    in first 16 bytes following RESBUF.  The result is always in little
59    endian byte order, so that a byte-wise output yields to the wanted
60    ASCII representation of the message digest.  */
61 extern void *md2_finish_ctx (struct md2_ctx *ctx, void *resbuf);
62
63
64 /* Put result from CTX in first 16 bytes following RESBUF.  The result is
65    always in little endian byte order, so that a byte-wise output yields
66    to the wanted ASCII representation of the message digest.  */
67 extern void *md2_read_ctx (const struct md2_ctx *ctx, void *resbuf);
68
69
70 /* Compute MD2 message digest for bytes read from STREAM.  The
71    resulting message digest number will be written into the 16 bytes
72    beginning at RESBLOCK.  */
73 extern int md2_stream (FILE *stream, void *resblock);
74
75 /* Compute MD2 message digest for LEN bytes beginning at BUFFER.  The
76    result is always in little endian byte order, so that a byte-wise
77    output yields to the wanted ASCII representation of the message
78    digest.  */
79 extern void *md2_buffer (const char *buffer, size_t len, void *resblock);
80
81 # ifdef __cplusplus
82 }
83 # endif
84
85 #endif