Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | 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 //! _
    00013 struct GOST_Info : public FixedBlockSize<8>, public FixedKeyLength<32>
    00014 {
    00015         static const char *StaticAlgorithmName() {return "GOST";}
    00016 };
    00017
    00018 /// <a href="http://www.weidai.com/scan-mirror/cs.html#GOST">GOST</a>
    00019 class GOST : public GOST_Info, public BlockCipherDocumentation
    00020 {
    00021         class CRYPTOPP_NO_VTABLE Base : public BlockCipherImpl<GOST_Info>
    00022         {
    00023         public:
    00024                 void UncheckedSetKey(CipherDir direction, const byte *userKey, unsigned int length);
    00025
    00026         protected:
    00027                 static void PrecalculateSTable();
    00028
    00029                 static const byte sBox[8][16];
    00030                 static bool sTableCalculated;
    00031                 static word32 sTable[4][256];
    00032
    00033                 FixedSizeSecBlock<word32, 8> key;
    00034         };
    00035
    00036         class CRYPTOPP_NO_VTABLE Enc : public Base
    00037         {
    00038         public:
    00039                 void ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const;
    00040         };
    00041
    00042         class CRYPTOPP_NO_VTABLE Dec : public Base
    00043         {
    00044         public:
    00045                 void ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const;
    00046         };
    00047
    00048 public:
    00049         typedef BlockCipherFinal<ENCRYPTION, Enc> Encryption;
    00050         typedef BlockCipherFinal<DECRYPTION, Dec> Decryption;
    00051 };
    00052
    00053 typedef GOST::Encryption GOSTEncryption;
    00054 typedef GOST::Decryption GOSTDecryption;
    00055
    00056 NAMESPACE_END
    00057
    00058 #endif