Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

/ray/src/lib/crypto/crc32hash.h

Go to the documentation of this file.
00001 /*
00002  * lib/crypto/crc32hash.h
00003  * 
00004  * Header file containing class CRC321Hash, a class for computation of 
00005  * the CRC32 checksum (POSIX.2) which is not a cryptographically secure 
00006  * hash algorithm. 
00007  * 
00008  * Copyright (c) 2004 by Wolfgang Wieser ] wwieser (a) gmx <*> de [ 
00009  * 
00010  * This file may be distributed and/or modified under the terms of the 
00011  * GNU General Public License version 2 as published by the Free Software 
00012  * Foundation. (See COPYING.GPL for details.)
00013  * 
00014  * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
00015  * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
00016  * 
00017  */
00018 
00019 #ifndef _LIB_CRYPTO_CRC32Hash_H_
00020 #define _LIB_CRYPTO_CRC32Hash_H_ 1
00021 
00031 #include <lib/crypto/shashbase.h>
00032 
00052 class CRC32Hash : public SecureHashBase
00053 {
00054     public:
00056         static const Parameters par;
00057         
00058     private:
00059         uint32 state;  
00060         //uint64 length; <- in base class // length of hashed data in BYTES. 
00061         
00063         static const uint32 crc32table[256];
00064         
00066         CRC32Hash(const CRC32Hash &);
00067         void operator=(const CRC32Hash &);
00068     public:
00070         CRC32Hash() : SecureHashBase()
00071             {  reset();  }
00073         ~CRC32Hash()
00074             {  reset();  }
00075         
00077         const Parameters *GetPar() const
00078             {  return(&CRC32Hash::par);  }
00079         
00081         uint64 FedBytes() const
00082             {  return(length);  }
00083         
00085         void reset();
00086         
00088         void feed(const char *buf,size_t len);
00089         
00091         void final();
00092         
00094         void GetHash(char *buf) const;
00095 };
00096 
00097 #endif  /* _LIB_CRYPTO_CRC32Hash_H_ */

Generated on Sat Feb 19 22:33:45 2005 for Ray by doxygen 1.3.5