00001 /*************************************************************************** 00002 md5.h - description 00003 ------------------- 00004 begin : Thu Dec 9 2004 00005 copyright : (C) 2004 by VooDooMan 00006 email : vdmfun@hotmail.com 00007 ***************************************************************************/ 00008 00009 /*************************************************************************** 00010 00011 VooDoo cIRCle - an IRC (ro)bot 00012 Copyright (C) by unknown author on the net :) 00013 Copyright (C) 2004 by Marian VooDooMan Meravy (vdmfun@hotmail.com) 00014 (re-coded from C to C++) 00015 00016 This program is free software; you can redistribute it and/or 00017 modify it under the terms of the GNU General Public License 00018 as published by the Free Software Foundation; either version 2 00019 of the License, or (at your option) any later version. 00020 00021 This program is distributed in the hope that it will be useful, 00022 but WITHOUT ANY WARRANTY; without even the implied warranty of 00023 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00024 GNU General Public License for more details. 00025 00026 You should have received a copy of the GNU General Public License 00027 along with this program; if not, write to the Free Software 00028 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 00029 00030 ****************************************************************************/ 00031 00032 /*! 00033 \file 00034 \brief Implements MD5 algorithm 00035 */ 00036 00037 #ifndef MD5_H 00038 #define MD5_H 00039 00040 #ifdef __alpha 00041 typedef unsigned int uint32; 00042 #else 00043 typedef unsigned long uint32; 00044 #endif 00045 00046 /*! 00047 \brief Stores MD5 context for computing 00048 \author VooDooMan 00049 \version 1 00050 \date 2004 00051 */ 00052 struct MD5Context { 00053 uint32 buf[4]; 00054 uint32 bits[2]; 00055 unsigned char in[64]; 00056 00057 MD5Context() 00058 { 00059 memset(this,0,sizeof(*this)); 00060 } 00061 }; 00062 00063 void MD5Init(MD5Context *ctx); 00064 void MD5Update(MD5Context *ctx, unsigned char *buf, unsigned len); 00065 void MD5Final(unsigned char digest[16], MD5Context *ctx); 00066 void MD5Transform(uint32 buf[4], uint32 in[16]); 00067 00068 /* 00069 * This is needed to make RSAREF happy on some MS-DOS compilers. 00070 */ 00071 typedef struct MD5Context MD5_CTX_; 00072 00073 #ifdef sgi 00074 #define HIGHFIRST 00075 #endif 00076 00077 #ifdef sun 00078 #define HIGHFIRST 00079 #endif 00080 00081 void byteReverse(unsigned char *buf, unsigned longs); 00082 00083 #endif /* !MD5_H */