/*1Copyright (C) 1999 Aladdin Enterprises. All rights reserved.23This software is provided 'as-is', without any express or implied4warranty. In no event will the authors be held liable for any damages5arising from the use of this software.67Permission is granted to anyone to use this software for any purpose,8including commercial applications, and to alter it and redistribute it9freely, subject to the following restrictions:10111. The origin of this software must not be misrepresented; you must not12claim that you wrote the original software. If you use this software13in a product, an acknowledgment in the product documentation would be14appreciated but is not required.152. Altered source versions must be plainly marked as such, and must not be16misrepresented as being the original software.173. This notice may not be removed or altered from any source distribution.1819L. Peter Deutsch20[email protected]2122*/23/*$Id: md5.h 3 2008-02-25 09:49:14Z keaston $ */24/*25Independent implementation of MD5 (RFC 1321).2627This code implements the MD5 Algorithm defined in RFC 1321.28It is derived directly from the text of the RFC and not from the29reference implementation.3031The original and principal author of md5.h is L. Peter Deutsch32<[email protected]>. Other authors are noted in the change history33that follows (in reverse chronological order):34351999-11-04 lpd Edited comments slightly for automatic TOC extraction.361999-10-18 lpd Fixed typo in header comment (ansi2knr rather than md5);37added conditionalization for C++ compilation from Martin38Purschke <[email protected]>.391999-05-03 lpd Original version.40*/4142#ifndef md5_INCLUDED43# define md5_INCLUDED4445/*46* This code has some adaptations for the Ghostscript environment, but it47* will compile and run correctly in any environment with 8-bit chars and48* 32-bit ints. Specifically, it assumes that if the following are49* defined, they have the same meaning as in Ghostscript: P1, P2, P3,50* ARCH_IS_BIG_ENDIAN.51*/5253typedef unsigned char md5_byte_t; /* 8-bit byte */54typedef unsigned int md5_word_t; /* 32-bit word */5556/* Define the state of the MD5 Algorithm. */57typedef struct md5_state_s {58md5_word_t count[2]; /* message length in bits, lsw first */59md5_word_t abcd[4]; /* digest buffer */60md5_byte_t buf[64]; /* accumulate block */61} md5_state_t;6263#ifdef __cplusplus64extern "C"65{66#endif6768/* Initialize the algorithm. */69#ifdef P170void md5_init(P1(md5_state_t *pms));71#else72void md5_init(md5_state_t *pms);73#endif7475/* Append a string to the message. */76#ifdef P377void md5_append(P3(md5_state_t *pms, const md5_byte_t *data, int nbytes));78#else79void md5_append(register md5_state_t *pms, const md5_byte_t *data, int nbytes);80#endif8182/* Finish the message and return the digest. */83#ifdef P284void md5_finish(P2(md5_state_t *pms, md5_byte_t digest[16]));85#else86void md5_finish(register md5_state_t *pms, md5_byte_t digest[16]);87#endif8889#ifdef __cplusplus90} /* end extern "C" */91#endif9293#endif /* md5_INCLUDED */949596