1
/* Declaration of functions and data types used for MD5 sum computing
3
Copyright (C) 1995-1997,1999,2000,2001,2004,2005,2006,2008
4
Free Software Foundation, Inc.
5
This file is part of the GNU C Library.
7
This program is free software; you can redistribute it and/or modify it
8
under the terms of the GNU Lesser General Public License as published by the
9
Free Software Foundation; either version 2.1, or (at your option) any
12
This program is distributed in the hope that it will be useful,
13
but WITHOUT ANY WARRANTY; without even the implied warranty of
14
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
GNU Lesser General Public License for more details.
17
You should have received a copy of the GNU Lesser General Public License
18
along with this program; if not, write to the Free Software Foundation,
19
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
27
#define MD5_DIGEST_SIZE 16
28
#define MD5_BLOCK_SIZE 64
31
# if defined __GNUC__ && defined __GNUC_MINOR__
32
# define __GNUC_PREREQ(maj, min) \
33
((__GNUC__ << 16) + __GNUC_MINOR__ >= ((maj) << 16) + (min))
35
# define __GNUC_PREREQ(maj, min) 0
40
# if defined __cplusplus && __GNUC_PREREQ (2,8)
41
# define __THROW throw ()
48
# define __md5_buffer md5_buffer
49
# define __md5_finish_ctx md5_finish_ctx
50
# define __md5_init_ctx md5_init_ctx
51
# define __md5_process_block md5_process_block
52
# define __md5_process_bytes md5_process_bytes
53
# define __md5_read_ctx md5_read_ctx
54
# define __md5_stream md5_stream
57
/* Structure to save state of computation between the single steps. */
71
* The following three functions are build up the low level used in
72
* the functions `md5_stream' and `md5_buffer'.
75
/* Initialize structure containing state of computation.
76
(RFC 1321, 3.3: Step 3) */
77
extern void __md5_init_ctx (struct md5_ctx *ctx) __THROW;
79
/* Starting with the result of former calls of this function (or the
80
initialization function update the context for the next LEN bytes
82
It is necessary that LEN is a multiple of 64!!! */
83
extern void __md5_process_block (const void *buffer, size_t len,
84
struct md5_ctx *ctx) __THROW;
86
/* Starting with the result of former calls of this function (or the
87
initialization function update the context for the next LEN bytes
89
It is NOT required that LEN is a multiple of 64. */
90
extern void __md5_process_bytes (const void *buffer, size_t len,
91
struct md5_ctx *ctx) __THROW;
93
/* Process the remaining bytes in the buffer and put result from CTX
94
in first 16 bytes following RESBUF. The result is always in little
95
endian byte order, so that a byte-wise output yields to the wanted
96
ASCII representation of the message digest. */
97
extern void *__md5_finish_ctx (struct md5_ctx *ctx, void *resbuf) __THROW;
100
/* Put result from CTX in first 16 bytes following RESBUF. The result is
101
always in little endian byte order, so that a byte-wise output yields
102
to the wanted ASCII representation of the message digest. */
103
extern void *__md5_read_ctx (const struct md5_ctx *ctx, void *resbuf) __THROW;
106
/* Compute MD5 message digest for bytes read from STREAM. The
107
resulting message digest number will be written into the 16 bytes
108
beginning at RESBLOCK. */
109
extern int __md5_stream (FILE *stream, void *resblock) __THROW;
111
/* Compute MD5 message digest for LEN bytes beginning at BUFFER. The
112
result is always in little endian byte order, so that a byte-wise
113
output yields to the wanted ASCII representation of the message
115
extern void *__md5_buffer (const char *buffer, size_t len,
116
void *resblock) __THROW;