/*1Copyright (C) 1999, 2002 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,v 1.4 2002/04/13 19:20:28 lpd Exp $ */24/*25Independent implementation of MD5 (RFC 1321).2627This code implements the MD5 Algorithm defined in RFC 1321, whose28text is available at29http://www.ietf.org/rfc/rfc1321.txt30The code is derived from the text of the RFC, including the test suite31(section A.5) but excluding the rest of Appendix A. It does not include32any code or documentation that is identified in the RFC as being33copyrighted.3435The original and principal author of md5.h is L. Peter Deutsch36<[email protected]>. Other authors are noted in the change history37that follows (in reverse chronological order):38392002-04-13 lpd Removed support for non-ANSI compilers; removed40references to Ghostscript; clarified derivation from RFC 1321;41now handles byte order either statically or dynamically.421999-11-04 lpd Edited comments slightly for automatic TOC extraction.431999-10-18 lpd Fixed typo in header comment (ansi2knr rather than md5);44added conditionalization for C++ compilation from Martin45Purschke <[email protected]>.461999-05-03 lpd Original version.47*/4849#ifndef md5_INCLUDED50# define md5_INCLUDED5152/*53* This package supports both compile-time and run-time determination of CPU54* byte order. If ARCH_IS_BIG_ENDIAN is defined as 0, the code will be55* compiled to run only on little-endian CPUs; if ARCH_IS_BIG_ENDIAN is56* defined as non-zero, the code will be compiled to run only on big-endian57* CPUs; if ARCH_IS_BIG_ENDIAN is not defined, the code will be compiled to58* run on either big- or little-endian CPUs, but will run slightly less59* efficiently on either one than if ARCH_IS_BIG_ENDIAN is defined.60*/6162typedef unsigned char md5_byte_t; /* 8-bit byte */63typedef unsigned int md5_word_t; /* 32-bit word */6465/* Define the state of the MD5 Algorithm. */66typedef struct md5_state_s {67md5_word_t count[2]; /* message length in bits, lsw first */68md5_word_t abcd[4]; /* digest buffer */69md5_byte_t buf[64]; /* accumulate block */70} md5_state_t;7172#ifdef __cplusplus73extern "C"74{75#endif7677/* Initialize the algorithm. */78void md5_init(md5_state_t *pms);7980/* Append a string to the message. */81void md5_append(md5_state_t *pms, const md5_byte_t *data, int nbytes);8283/* Finish the message and return the digest. */84void md5_finish(md5_state_t *pms, md5_byte_t digest[16]);8586#ifdef __cplusplus87} /* end extern "C" */88#endif8990#endif /* md5_INCLUDED */919293