1 /* 2 3 ************************************************************************* 4 5 ArmageTron -- Just another Tron Lightcycle Game in 3D. 6 7 This file was taken from GNU-Ghostscript from Aladdin Enterprises; original 8 header and copyright notice follow. As I interpret the copyright and licensing 9 statement, it would be OK to keep this code even for non-GPL distribution. 10 ( may be needed sometime if third party, non-Free code gets integrated ) 11 12 ************************************************************************** 13 14 This program is free software; you can redistribute it and/or 15 modify it under the terms of the GNU General Public License 16 as published by the Free Software Foundation; either version 2 17 of the License, or (at your option) any later version. 18 19 This program is distributed in the hope that it will be useful, 20 but WITHOUT ANY WARRANTY; without even the implied warranty of 21 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 22 GNU General Public License for more details. 23 24 You should have received a copy of the GNU General Public License 25 along with this program; if not, write to the Free Software 26 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 27 28 *************************************************************************** 29 30 */ 31 32 33 /* 34 Copyright (C) 1999 Aladdin Enterprises. All rights reserved. 35 36 This software is provided 'as-is', without any express or implied 37 warranty. In no event will the authors be held liable for any damages 38 arising from the use of this software. 39 40 Permission is granted to anyone to use this software for any purpose, 41 including commercial applications, and to alter it and redistribute it 42 freely, subject to the following restrictions: 43 44 1. The origin of this software must not be misrepresented; you must not 45 claim that you wrote the original software. If you use this software 46 in a product, an acknowledgment in the product documentation would be 47 appreciated but is not required. 48 2. Altered source versions must be plainly marked as such, and must not be 49 misrepresented as being the original software. 50 3. This notice may not be removed or altered from any source distribution. 51 52 L. Peter Deutsch 53 ghost@aladdin.com 54 55 */ 56 /*$RCSfile$ $Revision$ */ 57 /* 58 Independent implementation of MD5 (RFC 1321). 59 60 This code implements the MD5 Algorithm defined in RFC 1321. 61 It is derived directly from the text of the RFC and not from the 62 reference implementation. 63 64 The original and principal author of md5.h is L. Peter Deutsch 65 <ghost@aladdin.com>. Other authors are noted in the change history 66 that follows (in reverse chronological order): 67 68 1999-11-04 lpd Edited comments slightly for automatic TOC extraction. 69 1999-10-18 lpd Fixed typo in header comment (ansi2knr rather than md5); 70 added conditionalization for C++ compilation from Martin 71 Purschke <purschke@bnl.gov>. 72 1999-05-03 lpd Original version. 73 */ 74 75 #ifndef md5_INCLUDED 76 # define md5_INCLUDED 77 78 /* 79 * This code has some adaptations for the Ghostscript environment, but it 80 * will compile and run correctly in any environment with 8-bit chars and 81 * 32-bit ints. Specifically, it assumes that if the following are 82 * defined, they have the same meaning as in Ghostscript: P1, P2, P3, 83 * ARCH_IS_BIG_ENDIAN. 84 */ 85 86 typedef unsigned char md5_byte_t; /* 8-bit byte */ 87 typedef unsigned int md5_word_t; /* 32-bit word */ 88 89 /* Define the state of the MD5 Algorithm. */ 90 typedef struct md5_state_s { 91 md5_word_t count[2]; /* message length in bits, lsw first */ 92 md5_word_t abcd[4]; /* digest buffer */ 93 md5_byte_t buf[64]; /* accumulate block */ 94 } md5_state_t; 95 96 #ifdef __cplusplus 97 extern "C" 98 { 99 #endif 100 101 /* Initialize the algorithm. */ 102 #ifdef P1 103 void md5_init(P1(md5_state_t *pms)); 104 #else 105 void md5_init(md5_state_t *pms); 106 #endif 107 108 /* Append a string to the message. */ 109 #ifdef P3 110 void md5_append(P3(md5_state_t *pms, const md5_byte_t *data, int nbytes)); 111 #else 112 void md5_append(md5_state_t *pms, const md5_byte_t *data, int nbytes); 113 #endif 114 115 /* Finish the message and return the digest. */ 116 #ifdef P2 117 void md5_finish(P2(md5_state_t *pms, md5_byte_t digest[16])); 118 #else 119 void md5_finish(md5_state_t *pms, md5_byte_t digest[16]); 120 #endif 121 122 #ifdef __cplusplus 123 } /* end extern "C" */ 124 #endif 125 126 #endif /* md5_INCLUDED */ 127