Update bibliography.
[gnutls.git] / lgl / md2.h
blob194f8f909bebff608fea5dec525f686c06bf917e
1 /* Declarations of functions and data types used for MD2 sum
2 library functions.
3 Copyright (C) 2000, 2001, 2003, 2005, 2008 Free Software Foundation, Inc.
5 This program is free software; you can redistribute it and/or modify it
6 under the terms of the GNU Lesser General Public License as published by the
7 Free Software Foundation; either version 2.1, or (at your option) any
8 later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU Lesser General Public License for more details.
15 You should have received a copy of the GNU Lesser General Public License
16 along with this program; if not, write to the Free Software Foundation,
17 Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
19 #ifndef MD2_H
20 # define MD2_H 1
22 # include <stdio.h>
23 # include <stddef.h>
25 # define MD2_DIGEST_SIZE 16
27 /* Structure to save state of computation between the single steps. */
28 struct md2_ctx
30 unsigned char chksum[16], X[48], buf[16];
31 size_t curlen;
35 /* Initialize structure containing state of computation. */
36 extern void md2_init_ctx (struct md2_ctx *ctx);
38 /* Starting with the result of former calls of this function (or the
39 initialization function update the context for the next LEN bytes
40 starting at BUFFER.
41 It is NOT required that LEN is a multiple of 64. */
42 extern void md2_process_block (const void *buffer, size_t len,
43 struct md2_ctx *ctx);
45 /* Starting with the result of former calls of this function (or the
46 initialization function update the context for the next LEN bytes
47 starting at BUFFER.
48 It is NOT required that LEN is a multiple of 64. */
49 extern void md2_process_bytes (const void *buffer, size_t len,
50 struct md2_ctx *ctx);
52 /* Process the remaining bytes in the buffer and put result from CTX
53 in first 16 bytes following RESBUF. The result is always in little
54 endian byte order, so that a byte-wise output yields to the wanted
55 ASCII representation of the message digest. */
56 extern void *md2_finish_ctx (struct md2_ctx *ctx, void *resbuf);
59 /* Put result from CTX in first 16 bytes following RESBUF. The result is
60 always in little endian byte order, so that a byte-wise output yields
61 to the wanted ASCII representation of the message digest. */
62 extern void *md2_read_ctx (const struct md2_ctx *ctx, void *resbuf);
65 /* Compute MD2 message digest for bytes read from STREAM. The
66 resulting message digest number will be written into the 16 bytes
67 beginning at RESBLOCK. */
68 extern int md2_stream (FILE *stream, void *resblock);
70 /* Compute MD2 message digest for LEN bytes beginning at BUFFER. The
71 result is always in little endian byte order, so that a byte-wise
72 output yields to the wanted ASCII representation of the message
73 digest. */
74 extern void *md2_buffer (const char *buffer, size_t len, void *resblock);
76 #endif