CrystalSpace

Public API Reference

csutil/md5.h
Go to the documentation of this file.
00001 /*
00002     Crystal Space utility library: MD5 class
00003     Original C code written by L. Peter Deutsch (see below)
00004     Adapted for Crystal Space by Michael Dale Long
00005     Completely re-engineered by Eric Sunshine <sunshine@sunshineco.com>
00006 
00007     This library is free software; you can redistribute it and/or
00008     modify it under the terms of the GNU Library General Public
00009     License as published by the Free Software Foundation; either
00010     version 2 of the License, or (at your option) any later version.
00011 
00012     This library is distributed in the hope that it will be useful,
00013     but WITHOUT ANY WARRANTY; without even the implied warranty of
00014     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00015     Library General Public License for more details.
00016 
00017     You should have received a copy of the GNU Library General Public
00018     License along with this library; if not, write to the Free
00019     Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00020 
00021 */
00022 
00023 /*
00024   Copyright (C) 1999 Aladdin Enterprises.  All rights reserved.
00025 
00026   This software is provided 'as-is', without any express or implied
00027   warranty.  In no event will the authors be held liable for any damages
00028   arising from the use of this software.
00029 
00030   Permission is granted to anyone to use this software for any purpose,
00031   including commercial applications, and to alter it and redistribute it
00032   freely, subject to the following restrictions:
00033 
00034   1. The origin of this software must not be misrepresented; you must not
00035      claim that you wrote the original software. If you use this software
00036      in a product, an acknowledgment in the product documentation would be
00037      appreciated but is not required.
00038   2. Altered source versions must be plainly marked as such, and must not be
00039      misrepresented as being the original software.
00040   3. This notice may not be removed or altered from any source distribution.
00041 
00042   L. Peter Deutsch
00043   ghost@aladdin.com
00044 
00045  */
00064 #ifndef __CS_MD5_H__
00065 #define __CS_MD5_H__
00066 
00067 #include "csextern.h"
00068 #include "csutil/csstring.h"
00069 #include "csutil/digest.h"
00070 #include "csutil/hash.h"
00071 
00072 namespace CS
00073 {
00074   namespace Utility
00075   {
00076     namespace Checksum
00077     {
00088       class CS_CRYSTALSPACE_EXPORT MD5
00089       {
00090       protected:
00092         typedef uint8 md5_byte_t;
00094         typedef uint32 md5_word_t;
00095 
00097 
00098         size_t count[2]; // message length in bits, lsw first
00099         md5_word_t abcd[4];  // digest buffer
00100         md5_byte_t buf[64];  // accumulate block
00102 
00103         void Process(const md5_byte_t* data/*[64]*/);
00104 
00106         void AppendInternal (const uint8* input, uint32 length);
00107       public:
00109         typedef CS::Utility::Checksum::Digest<16> Digest;
00110         
00111         MD5 ();
00112 
00118         void Append (const uint8* input, size_t length);
00119         
00126         Digest Finish ();
00127 
00129         static Digest Encode(csString const&);
00131         static Digest Encode(const char*);
00133         static Digest Encode(const void*, size_t nbytes);
00134       };
00135     } //namespace Checksum
00136   } //namespace Utility
00137 } //namespace CS
00138 
00139 typedef CS_DEPRECATED_TYPE_MSG("Use CS::Utility::Checksum::MD5 instead")
00140   CS::Utility::Checksum::MD5 csMD5;
00141 
00142 #endif // __CS_MD5_H__
00143 

Generated for Crystal Space 2.0 by doxygen 1.7.6.1