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

cast.h

Go to the documentation of this file.
00001 #ifndef CRYPTOPP_CAST_H
00002 #define CRYPTOPP_CAST_H
00003 
00007 #include "cryptlib.h"
00008 #include "misc.h"
00009 
00010 NAMESPACE_BEGIN(CryptoPP)
00011 
00012 class CAST
00013 {
00014 protected:
00015         static const word32 S[8][256];
00016 };
00017 
00019 class CAST128 : public FixedBlockSize<8>, public CAST, public VariableKeyLength<16, 5, 16>
00020 {
00021 protected:
00022         // keylength should be between 5 and 16
00023         CAST128(const byte *userKey, unsigned int keylength);
00024 
00025         bool reduced;
00026         SecBlock<word32> K;
00027 };
00028 
00030 class CAST128Encryption : public CAST128
00031 {
00032 public:
00033         CAST128Encryption(const byte *userKey, unsigned int keylength=DEFAULT_KEYLENGTH)
00034                 : CAST128(userKey, keylength) {}
00035 
00036         void ProcessBlock(const byte *inBlock, byte * outBlock) const;
00037         void ProcessBlock(byte * inoutBlock) const
00038                 {CAST128Encryption::ProcessBlock(inoutBlock, inoutBlock);}
00039 };
00040 
00042 class CAST128Decryption : public CAST128
00043 {
00044 public:
00045         CAST128Decryption(const byte *userKey, unsigned int keylength=DEFAULT_KEYLENGTH)
00046                 : CAST128(userKey, keylength) {}
00047 
00048         void ProcessBlock(const byte *inBlock, byte * outBlock) const;
00049         void ProcessBlock(byte * inoutBlock) const
00050                 {CAST128Decryption::ProcessBlock(inoutBlock, inoutBlock);}
00051 };
00052 
00054 class CAST256 : public FixedBlockSize<16>, public CAST, public VariableKeyLength<16, 16, 32>
00055 {
00056 public:
00057         void ProcessBlock(const byte *inBlock, byte * outBlock) const;
00058         void ProcessBlock(byte * inoutBlock) const
00059                 {CAST256::ProcessBlock(inoutBlock, inoutBlock);}
00060 
00061 protected:
00062         CAST256(const byte *userKey, unsigned int keylength);
00063 
00064         SecBlock<word32> K;
00065 
00066 private:
00067         static const word32 t_m[8][24];
00068         static const unsigned int t_r[8][24];
00069 
00070         static void Omega(int i, word32 kappa[8]);
00071 };
00072 
00074 class CAST256Encryption : public CAST256
00075 {
00076 public:
00077         CAST256Encryption(const byte *userKey, unsigned int keylength=DEFAULT_KEYLENGTH)
00078                 : CAST256(userKey, keylength) {}
00079 };
00080 
00082 class CAST256Decryption : public CAST256
00083 {
00084 public:
00085         CAST256Decryption(const byte *userKey, unsigned int keylength=DEFAULT_KEYLENGTH);
00086 };
00087 
00088 NAMESPACE_END
00089 
00090 #endif

Generated at Mon Jan 15 01:16:29 2001 for Crypto++ by doxygen1.2.4 written by Dimitri van Heesch, © 1997-2000