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

/ray/src/lib/crypto/blowfishcipher.h

Go to the documentation of this file.
00001 /*
00002  * lib/crypto/blowfishcipher.h
00003  * 
00004  * Header file containing class BlowFishCipher, a class for 
00005  * encrypting/decrypting data using the blowfish 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_BlowFishCipher_H_
00020 #define _LIB_CRYPTO_BlowFishCipher_H_ 1
00021 
00030 #include <lib/crypto/bcipherbase.h>
00031 
00055 class BlowFishCipher : public BlockCipherBase
00056 {
00057     public:
00059         static const BlockCipherBase::Parameters par;
00060         
00061     private:
00063 
00064         uint32 c_P[18];      //   72 bytes
00065         uint32 c_S[1024];    // 4096 bytes
00067         
00069         inline void _EncryptRounds(uint32 *_yl,uint32 *_yr);
00070         
00072         void _reset();
00073         
00075         BlowFishCipher(const BlowFishCipher &);
00076         void operator=(const BlowFishCipher &);
00077     public:
00079         BlowFishCipher() : BlockCipherBase()  {}
00081         ~BlowFishCipher()  {  _reset();  }
00082         
00084         const Parameters *GetPar() const
00085             {  return(&BlowFishCipher::par);  }
00086         
00103         int SetKey(char *userkey,size_t len);
00104         
00114         int CheckWeakKey();
00115         
00122 
00123         void EncryptBlock(char *ibuf,char *obuf);
00124         void DecryptBlock(char *ibuf,char *obuf);
00126         
00134         int CopyFrom(BlockCipherBase *from);
00135 };
00136 
00137 #endif   /* _LIB_CRYPTO_BlowFishCipher_H_ */

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