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

# camellia.h

Go to the documentation of this file.

    00001 #ifndef CRYPTOPP_CAMELLIA_H
    00002 #define CRYPTOPP_CAMELLIA_H
    00003
    00004 #include "config.h"
    00005
    00006 #ifdef WORD64_AVAILABLE
    00007
    00008 /** \file
    00009 */
    00010
    00011 #include "seckey.h"
    00012 #include "secblock.h"
    00013
    00014 NAMESPACE_BEGIN(CryptoPP)
    00015
    00016 //! _
    00017 struct Camellia_Info : public FixedBlockSize<16>, public VariableKeyLength<16, 16, 32, 8>
    00018 {
    00019         static const char *StaticAlgorithmName() {return "Camellia";}
    00020 };
    00021
    00022 /// <a href="http://www.weidai.com/scan-mirror/cs.html#Camellia">Camellia</a>
    00023 class Camellia : public Camellia_Info, public BlockCipherDocumentation
    00024 {
    00025         class CRYPTOPP_NO_VTABLE Base : public BlockCipherImpl<Camellia_Info>
    00026         {
    00027         public:
    00028                 void UncheckedSetKey(CipherDir dir, const byte *key, unsigned int keylen);
    00029                 void ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const;
    00030
    00031         protected:
    00032                 static word64 F(word64 X);
    00033                 static void FLlayer(word64 *x, word64 K1, word64 K2);
    00034
    00035                 static const byte s1[256];
    00036                 static const byte s2[256];
    00037                 static const byte s3[256];
    00038                 static const byte s4[256];
    00039
    00040                 unsigned int m_rounds;
    00041                 SecBlock<word64> m_key;
    00042         };
    00043
    00044 public:
    00045         typedef BlockCipherFinal<ENCRYPTION, Base> Encryption;
    00046         typedef BlockCipherFinal<DECRYPTION, Base> Decryption;
    00047 };
    00048
    00049 typedef Camellia::Encryption CamelliaEncryption;
    00050 typedef Camellia::Decryption CamelliaDecryption;
    00051
    00052 NAMESPACE_END
    00053
    00054 #endif
    00055
    00056 #endif