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

square.h

Go to the documentation of this file.
00001 #ifndef CRYPTOPP_SQUARE_H
00002 #define CRYPTOPP_SQUARE_H
00003 
00007 #include "config.h"
00008 
00009 #include "cryptlib.h"
00010 #include "misc.h"
00011 
00012 NAMESPACE_BEGIN(CryptoPP)
00013 
00015 class SquareBase : public FixedBlockSize<16>, public FixedKeyLength<16>
00016 {
00017 public:
00018         enum {ROUNDS=8};
00019 
00020 protected:
00021         SquareBase(const byte *userKey, CipherDir dir);
00022 
00023         SecBlock<word32[4]> roundkeys;
00024 };
00025 
00027 class SquareEncryption : public SquareBase
00028 {
00029 public:
00030         SquareEncryption(const byte *key, unsigned int = 0) : SquareBase(key, ENCRYPTION) {}
00031 
00032         void ProcessBlock(byte * inoutBlock) const
00033                 {SquareEncryption::ProcessBlock(inoutBlock, inoutBlock);}
00034         void ProcessBlock(const byte *inBlock, byte * outBlock) const;
00035 
00036 private:
00037         static const byte Se[256];
00038         static const word32 Te[4][256];
00039 };
00040 
00042 class SquareDecryption : public SquareBase
00043 {
00044 public:
00045         SquareDecryption(const byte *key, unsigned int = 0) : SquareBase(key, DECRYPTION) {}
00046 
00047         void ProcessBlock(byte * inoutBlock) const
00048                 {SquareDecryption::ProcessBlock(inoutBlock, inoutBlock);}
00049         void ProcessBlock(const byte *inBlock, byte * outBlock) const;
00050 
00051 private:
00052         static const byte Sd[256];
00053         static const word32 Td[4][256];
00054 };
00055 
00056 NAMESPACE_END
00057 
00058 #endif

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