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

/ray/src/lib/crypto/twofishcipher.h

Go to the documentation of this file.
00001 /*
00002  * lib/crypto/twofishcipher.h
00003  * 
00004  * Header file containing class TwoFishCipher, a class for 
00005  * encrypting/decrypting data using the twofish algorithm 
00006  * (Bruce Schneier et al). 
00007  * 
00008  * Copyright (c) 2001--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_TwoFishCipher_H_
00020 #define _LIB_CRYPTO_TwoFishCipher_H_ 1
00021 
00030 #include <lib/crypto/bcipherbase.h>
00031 
00032 
00066 class TwoFishCipher : public BlockCipherBase
00067 {
00068     public:
00070         static const BlockCipherBase::Parameters par;
00071         
00072     private:
00080 
00081         uint32 c_w[8];       //   32 bytes
00082         uint32 c_k[32];      //  128 bytes
00083         uint32 c_s[4][256];  // 4096 bytes
00085         
00087         void _reset();
00088         
00090         TwoFishCipher(const TwoFishCipher &);
00091         void operator=(const TwoFishCipher &);
00092     public:
00094         TwoFishCipher() : BlockCipherBase()  {}
00096         ~TwoFishCipher()  {  _reset();  }
00097         
00099         const Parameters *GetPar() const
00100             {  return(&TwoFishCipher::par);  }
00101         
00118         int SetKey(char *userkey,size_t len);
00119         
00128         int CheckWeakKey();
00129         
00136 
00137         void EncryptBlock(char *ibuf,char *obuf);
00138         void DecryptBlock(char *ibuf,char *obuf);
00140         
00148         int CopyFrom(BlockCipherBase *from);
00149 };
00150 
00151 #endif   /* _LIB_CRYPTO_TwoFishCipher_H_ */

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