includes/wxChecksums-1.2.0/src/md5.hpp

Go to the documentation of this file.
00001 /*
00002  * MD5
00003  * Written by Julien Couot.
00004  * Original C version written by Ulrich Drepper.
00005  *
00006  * This program is free software; you can redistribute it and/or
00007  * modify it under the terms of the GNU General Public License
00008  * as published by the Free Software Foundation; either version 2
00009  * of the License, or (at your option) any later version.
00010  *
00011  * This program is distributed in the hope that it will be useful,
00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014  * GNU General Public License for more details.
00015  *
00016  * You should have received a copy of the GNU General Public License
00017  * along with this program; if not, write to the Free Software
00018  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
00019  */
00020 
00026 //---------------------------------------------------------------------------
00027 // For compilers that support precompilation, includes "wx.h".
00028 #include <wx/wxprec.h>
00029 
00030 #ifdef __BORLANDC__
00031 #pragma hdrstop
00032 #endif
00033 
00034 #ifndef WX_PRECOMP
00035 // Include your minimal set of headers here, or wx.h
00036 #include <wx/wx.h>
00037 #endif
00038 #include "checksum.hpp"
00039 //---------------------------------------------------------------------------
00040 
00041 
00063 class MD5 : public Checksum
00064 {
00065  protected:
00066   // Change the following types if needed.
00067 //  typedef  unsigned long      md5_uint32_t;  ///< unsigned 4 bytes integer.
00068 //  typedef  unsigned short     md5_uint16_t;  ///< unsigned 2 bytes integer.
00069 //  typedef  unsigned char      md5_uint8_t;   ///< unsigned 1 byte integer.
00070 //  typedef  unsigned long int  md5_uintptr_t; ///< unsigned 4 bytes integer.
00071   
00072   // State of computation between the single steps.
00073   wxUint32 A_;  
00074   wxUint32 B_;  
00075   wxUint32 C_;  
00076   wxUint32 D_;  
00077 
00078   wxUint32 total[2];     
00079   wxUint32 buflen;       
00080   wxByte   ibuffer[128]; 
00081 
00086   static const wxByte fillbuf[64];
00087 
00088  public:
00092   MD5();
00093 
00097   void reset();
00098 
00109   void* getValue(void* buffer) const;
00110 
00118   wxString getValue(const bool hexInUpperCase = false) const;
00119 
00126   void update(const wxByte* buf, unsigned int len);
00127 
00128  protected:
00133   void finish();
00134 
00143   void process_block(const void* buf, size_t len);
00144 };
00145 //---------------------------------------------------------------------------

Generated on Mon Feb 20 11:06:41 2006 for wxFlickr by  doxygen 1.4.6-NO