2003-03-24 17:49:56 +00:00
|
|
|
/* Declaration of functions and data types used for MD5 sum computing
|
|
|
|
library functions.
|
|
|
|
Copyright (C) 1995,1996,1997,1999,2000,2001 Free Software Foundation, Inc.
|
|
|
|
This file is part of the GNU C Library.
|
|
|
|
|
|
|
|
The GNU C Library is free software; you can redistribute it and/or
|
|
|
|
modify it under the terms of the GNU Lesser General Public
|
|
|
|
License as published by the Free Software Foundation; either
|
|
|
|
version 2.1 of the License, or (at your option) any later version.
|
|
|
|
|
|
|
|
The GNU C Library is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
Lesser General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU Lesser General Public
|
|
|
|
License along with the GNU C Library; if not, write to the Free
|
|
|
|
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
|
|
|
02111-1307 USA. */
|
|
|
|
|
|
|
|
#ifndef _MD5_H
|
|
|
|
#define _MD5_H 1
|
|
|
|
|
2005-05-04 16:32:54 +00:00
|
|
|
#include <inttypes.h>
|
2003-03-24 17:49:56 +00:00
|
|
|
typedef uint32_t md5_uint32;
|
|
|
|
typedef uintptr_t md5_uintptr;
|
|
|
|
|
|
|
|
/* Structure to save state of computation between the single steps. */
|
2006-02-13 19:52:43 +00:00
|
|
|
struct MD5_CTX
|
2003-03-24 17:49:56 +00:00
|
|
|
{
|
|
|
|
md5_uint32 A;
|
|
|
|
md5_uint32 B;
|
|
|
|
md5_uint32 C;
|
|
|
|
md5_uint32 D;
|
|
|
|
|
|
|
|
md5_uint32 total[2];
|
|
|
|
md5_uint32 buflen;
|
|
|
|
char buffer[128] __attribute__ ((__aligned__ (__alignof__ (md5_uint32))));
|
|
|
|
};
|
|
|
|
|
|
|
|
/*
|
|
|
|
* The following three functions are build up the low level used in
|
|
|
|
* the functions `md5_stream' and `md5_buffer'.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* Initialize structure containing state of computation.
|
|
|
|
(RFC 1321, 3.3: Step 3) */
|
2006-05-24 13:23:20 +00:00
|
|
|
extern void MD5_Init (struct MD5_CTX *ctx);
|
2003-03-24 17:49:56 +00:00
|
|
|
|
|
|
|
/* Starting with the result of former calls of this function (or the
|
|
|
|
initialization function update the context for the next LEN bytes
|
|
|
|
starting at BUFFER.
|
|
|
|
It is necessary that LEN is a multiple of 64!!! */
|
2006-05-24 13:23:20 +00:00
|
|
|
extern void md5_process_block (const void *buffer, size_t len,
|
|
|
|
struct MD5_CTX *ctx);
|
2003-03-24 17:49:56 +00:00
|
|
|
|
|
|
|
/* Starting with the result of former calls of this function (or the
|
|
|
|
initialization function update the context for the next LEN bytes
|
|
|
|
starting at BUFFER.
|
|
|
|
It is NOT required that LEN is a multiple of 64. */
|
2006-05-24 13:23:20 +00:00
|
|
|
extern void MD5_Update (struct MD5_CTX *ctx, const void *buffer, size_t len);
|
2003-03-24 17:49:56 +00:00
|
|
|
|
|
|
|
/* Process the remaining bytes in the buffer and put result from CTX
|
|
|
|
in first 16 bytes following RESBUF. The result is always in little
|
|
|
|
endian byte order, so that a byte-wise output yields to the wanted
|
|
|
|
ASCII representation of the message digest.
|
|
|
|
|
|
|
|
IMPORTANT: On some systems it is required that RESBUF is correctly
|
|
|
|
aligned for a 32 bits value. */
|
2006-05-24 13:23:20 +00:00
|
|
|
extern void *MD5_Final (void *resbuf, struct MD5_CTX *ctx);
|
2003-03-24 17:49:56 +00:00
|
|
|
|
|
|
|
|
|
|
|
/* Put result from CTX in first 16 bytes following RESBUF. The result is
|
|
|
|
always in little endian byte order, so that a byte-wise output yields
|
|
|
|
to the wanted ASCII representation of the message digest.
|
|
|
|
|
|
|
|
IMPORTANT: On some systems it is required that RESBUF is correctly
|
|
|
|
aligned for a 32 bits value. */
|
2006-05-24 13:23:20 +00:00
|
|
|
extern void *md5_read_ctx (const struct MD5_CTX *ctx, void *resbuf);
|
2003-03-24 17:49:56 +00:00
|
|
|
|
|
|
|
|
|
|
|
#endif /* md5.h */
|