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

gost.h

Go to the documentation of this file.
00001 #ifndef CRYPTOPP_GOST_H
00002 #define CRYPTOPP_GOST_H
00003 
00004 /** \file
00005 */
00006 
00007 #include "seckey.h"
00008 #include "secblock.h"
00009 
00010 NAMESPACE_BEGIN(CryptoPP)
00011 
00012 struct GOST_Info : public FixedBlockSize<8>, public FixedKeyLength<32>
00013 {
00014         static const char *StaticAlgorithmName() {return "GOST";}
00015 };
00016 
00017 /// <a href="http://www.weidai.com/scan-mirror/cs.html#GOST">GOST</a>
00018 class GOST : public GOST_Info, public BlockCipherDocumentation
00019 {
00020         class Base : public BlockCipherBaseTemplate<GOST_Info>
00021         {
00022         public:
00023                 void UncheckedSetKey(CipherDir direction, const byte *userKey, unsigned int length);
00024 
00025         protected:
00026                 static void PrecalculateSTable();
00027 
00028                 static const byte sBox[8][16];
00029                 static bool sTableCalculated;
00030                 static word32 sTable[4][256];
00031 
00032                 FixedSizeSecBlock<word32, 8> key;
00033         };
00034 
00035         class Enc : public Base
00036         {
00037         public:
00038                 void ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const;
00039         };
00040 
00041         class Dec : public Base
00042         {
00043         public:
00044                 void ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const;
00045         };
00046 
00047 public:
00048         typedef BlockCipherTemplate<ENCRYPTION, Enc> Encryption;
00049         typedef BlockCipherTemplate<DECRYPTION, Dec> Decryption;
00050 };
00051 
00052 typedef GOST::Encryption GOSTEncryption;
00053 typedef GOST::Decryption GOSTDecryption;
00054 
00055 NAMESPACE_END
00056 
00057 #endif

Generated on Sun Mar 14 20:44:26 2004 for Crypto++ by doxygen 1.3.6-20040222