Mercurial > hg > octave-kai > gnulib-hg
annotate lib/md4.h @ 9084:2932e92d6e31
* lib/version-etc.c (version_etc_va): Default to GPLv3+.
* NEWS: Document this change.
author | Eric Blake <ebb9@byu.net> |
---|---|
date | Tue, 10 Jul 2007 12:22:36 +0000 |
parents | 7f3d97f1f72d |
children | b704008db267 |
rev | line source |
---|---|
6393 | 1 /* Declarations of functions and data types used for MD4 sum |
2 library functions. | |
3 Copyright (C) 2000, 2001, 2003, 2005 Free Software Foundation, Inc. | |
4 | |
5 This program is free software; you can redistribute it and/or modify it | |
6 under the terms of the GNU General Public License as published by the | |
7 Free Software Foundation; either version 2, or (at your option) any | |
8 later version. | |
9 | |
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 General Public License for more details. | |
14 | |
15 You should have received a copy of the GNU 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. */ | |
18 | |
19 #ifndef MD4_H | |
20 # define MD4_H 1 | |
21 | |
22 # include <stdio.h> | |
23 # include <stdint.h> | |
24 | |
6422
833177ba48f0
* md4.c, md4.c: Simplify buffer handling visavi alignment,
Simon Josefsson <simon@josefsson.org>
parents:
6393
diff
changeset
|
25 # define MD4_DIGEST_SIZE 16 |
6393 | 26 |
27 /* Structure to save state of computation between the single steps. */ | |
28 struct md4_ctx | |
29 { | |
30 uint32_t A; | |
31 uint32_t B; | |
32 uint32_t C; | |
33 uint32_t D; | |
34 | |
35 uint32_t total[2]; | |
36 uint32_t buflen; | |
6428
7f3d97f1f72d
* md4.h: Shrink buffer size, now that we changed the type.
Simon Josefsson <simon@josefsson.org>
parents:
6422
diff
changeset
|
37 uint32_t buffer[32]; |
6393 | 38 }; |
39 | |
40 | |
41 /* Initialize structure containing state of computation. */ | |
42 extern void md4_init_ctx (struct md4_ctx *ctx); | |
43 | |
44 /* Starting with the result of former calls of this function (or the | |
45 initialization function update the context for the next LEN bytes | |
46 starting at BUFFER. | |
47 It is necessary that LEN is a multiple of 64!!! */ | |
48 extern void md4_process_block (const void *buffer, size_t len, | |
49 struct md4_ctx *ctx); | |
50 | |
51 /* Starting with the result of former calls of this function (or the | |
52 initialization function update the context for the next LEN bytes | |
53 starting at BUFFER. | |
54 It is NOT required that LEN is a multiple of 64. */ | |
55 extern void md4_process_bytes (const void *buffer, size_t len, | |
56 struct md4_ctx *ctx); | |
57 | |
58 /* Process the remaining bytes in the buffer and put result from CTX | |
59 in first 16 bytes following RESBUF. The result is always in little | |
60 endian byte order, so that a byte-wise output yields to the wanted | |
61 ASCII representation of the message digest. | |
62 | |
63 IMPORTANT: On some systems it is required that RESBUF be correctly | |
64 aligned for a 32 bits value. */ | |
65 extern void *md4_finish_ctx (struct md4_ctx *ctx, void *resbuf); | |
66 | |
67 | |
68 /* Put result from CTX in first 16 bytes following RESBUF. The result is | |
69 always in little endian byte order, so that a byte-wise output yields | |
70 to the wanted ASCII representation of the message digest. | |
71 | |
72 IMPORTANT: On some systems it is required that RESBUF is correctly | |
73 aligned for a 32 bits value. */ | |
74 extern void *md4_read_ctx (const struct md4_ctx *ctx, void *resbuf); | |
75 | |
76 | |
77 /* Compute MD4 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 md4_stream (FILE * stream, void *resblock); | |
81 | |
82 /* Compute MD4 message digest for LEN bytes beginning at BUFFER. The | |
83 result is always in little endian byte order, so that a byte-wise | |
84 output yields to the wanted ASCII representation of the message | |
85 digest. */ | |
86 extern void *md4_buffer (const char *buffer, size_t len, void *resblock); | |
87 | |
88 #endif |