00001 /* Declarations of functions and data types used for MD4 sum 00002 library functions. 00003 Copyright (C) 2000, 2001, 2003, 2005, 2008 Free Software Foundation, Inc. 00004 00005 This program is free software; you can redistribute it and/or modify it 00006 under the terms of the GNU Lesser General Public License as published by the 00007 Free Software Foundation; either version 2.1, or (at your option) any 00008 later version. 00009 00010 This program is distributed in the hope that it will be useful, 00011 but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00013 GNU Lesser General Public License for more details. 00014 00015 You should have received a copy of the GNU Lesser General Public License 00016 along with this program; if not, write to the Free Software Foundation, 00017 Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ 00018 00019 #ifndef MD4_H 00020 # define MD4_H 1 00021 00022 # include <stdio.h> 00023 # include <stdint.h> 00024 00025 # define MD4_DIGEST_SIZE 16 00026 00027 /* Structure to save state of computation between the single steps. */ 00028 struct md4_ctx 00029 { 00030 uint32_t A; 00031 uint32_t B; 00032 uint32_t C; 00033 uint32_t D; 00034 00035 uint32_t total[2]; 00036 uint32_t buflen; 00037 uint32_t buffer[32]; 00038 }; 00039 00040 00041 /* Initialize structure containing state of computation. */ 00042 extern void md4_init_ctx (struct md4_ctx *ctx); 00043 00044 /* Starting with the result of former calls of this function (or the 00045 initialization function update the context for the next LEN bytes 00046 starting at BUFFER. 00047 It is necessary that LEN is a multiple of 64!!! */ 00048 extern void md4_process_block (const void *buffer, size_t len, 00049 struct md4_ctx *ctx); 00050 00051 /* Starting with the result of former calls of this function (or the 00052 initialization function update the context for the next LEN bytes 00053 starting at BUFFER. 00054 It is NOT required that LEN is a multiple of 64. */ 00055 extern void md4_process_bytes (const void *buffer, size_t len, 00056 struct md4_ctx *ctx); 00057 00058 /* Process the remaining bytes in the buffer and put result from CTX 00059 in first 16 bytes following RESBUF. The result is always in little 00060 endian byte order, so that a byte-wise output yields to the wanted 00061 ASCII representation of the message digest. */ 00062 extern void *md4_finish_ctx (struct md4_ctx *ctx, void *resbuf); 00063 00064 00065 /* Put result from CTX in first 16 bytes following RESBUF. The result is 00066 always in little endian byte order, so that a byte-wise output yields 00067 to the wanted ASCII representation of the message digest. */ 00068 extern void *md4_read_ctx (const struct md4_ctx *ctx, void *resbuf); 00069 00070 00071 /* Compute MD4 message digest for bytes read from STREAM. The 00072 resulting message digest number will be written into the 16 bytes 00073 beginning at RESBLOCK. */ 00074 extern int md4_stream (FILE * stream, void *resblock); 00075 00076 /* Compute MD4 message digest for LEN bytes beginning at BUFFER. The 00077 result is always in little endian byte order, so that a byte-wise 00078 output yields to the wanted ASCII representation of the message 00079 digest. */ 00080 extern void *md4_buffer (const char *buffer, size_t len, void *resblock); 00081 00082 #endif