CrystalSpace

Public API Reference

Main Page   Modules   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

csmd5.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   Copyright (C) 1999 Aladdin Enterprises.  All rights reserved.
00024 
00025   This software is provided 'as-is', without any express or implied
00026   warranty.  In no event will the authors be held liable for any damages
00027   arising from the use of this software.
00028 
00029   Permission is granted to anyone to use this software for any purpose,
00030   including commercial applications, and to alter it and redistribute it
00031   freely, subject to the following restrictions:
00032 
00033   1. The origin of this software must not be misrepresented; you must not
00034      claim that you wrote the original software. If you use this software
00035      in a product, an acknowledgment in the product documentation would be
00036      appreciated but is not required.
00037   2. Altered source versions must be plainly marked as such, and must not be
00038      misrepresented as being the original software.
00039   3. This notice may not be removed or altered from any source distribution.
00040 
00041   L. Peter Deutsch
00042   ghost@aladdin.com
00043 
00044  */
00063 #ifndef __CS_CSMD5_H__
00064 #define __CS_CSMD5_H__
00065 
00073 class csMD5
00074 {
00075 // Peter's raw interface
00076 public:
00078   typedef unsigned char md5_byte_t;
00080   typedef unsigned int md5_word_t;
00081 
00083   struct md5_state_t
00084   {
00085     md5_word_t count[2]; // message length in bits, lsw first
00086     md5_word_t abcd[4];  // digest buffer
00087     md5_byte_t buf[64];  // accumulate block
00088   };
00089 
00091   static void md5_init(md5_state_t*);
00093   static void md5_append(md5_state_t*, const md5_byte_t* data, int nbytes);
00095   static void md5_finish(md5_state_t*, md5_byte_t digest[16]);
00096 
00097 protected:
00098   static void md5_process(md5_state_t*, const md5_byte_t* data/*[64]*/);
00099 
00100 // Our friendly interface
00101 public:
00103   struct Digest { md5_byte_t data[16]; };
00104 
00106   static Digest Encode(const char*);
00108   static Digest Encode(const void*, int nbytes);
00109 };
00110 
00111 #endif // __CS_CSMD5_H__

Generated for Crystal Space by doxygen 1.2.14