00001 #ifndef CRYPTOPP_GOST_H
00002 #define CRYPTOPP_GOST_H
00003
00007 #include "cryptlib.h"
00008 #include "misc.h"
00009
00010 NAMESPACE_BEGIN(CryptoPP)
00011
00013 class GOST : public FixedBlockSize<8>, public FixedKeyLength<32>
00014 {
00015 protected:
00016 GOST(const byte *userKey, CipherDir);
00017 static void PrecalculateSTable();
00018
00019 static const byte sBox[8][16];
00020 static bool sTableCalculated;
00021 static word32 sTable[4][256];
00022
00023 SecBlock<word32> key;
00024 };
00025
00027 class GOSTEncryption : public GOST
00028 {
00029 public:
00030 GOSTEncryption(const byte * userKey, unsigned int = 0)
00031 : GOST (userKey, ENCRYPTION) {}
00032
00033 void ProcessBlock(const byte *inBlock, byte * outBlock) const;
00034 void ProcessBlock(byte * inoutBlock) const
00035 {GOSTEncryption::ProcessBlock(inoutBlock, inoutBlock);}
00036 };
00037
00039 class GOSTDecryption : public GOST
00040 {
00041 public:
00042 GOSTDecryption(const byte * userKey, unsigned int = 0)
00043 : GOST (userKey, DECRYPTION) {}
00044
00045 void ProcessBlock(const byte *inBlock, byte * outBlock) const;
00046 void ProcessBlock(byte * inoutBlock) const
00047 {GOSTDecryption::ProcessBlock(inoutBlock, inoutBlock);}
00048 };
00049
00050 NAMESPACE_END
00051
00052 #endif