- Main Page
- Namespaces
- Classes
- Files

- File List
- 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(const byte *key, unsigned int keylen, const NameValuePairs &params);
    00029                 void ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const;
    00030                 unsigned int BlockAlignment() const {return 8;}
    00031
    00032         protected:
    00033                 static word64 F(word64 X);
    00034                 static void FLlayer(word64 *x, word64 K1, word64 K2);
    00035
    00036                 static const byte s1[256];
    00037                 static const byte s2[256];
    00038                 static const byte s3[256];
    00039                 static const byte s4[256];
    00040
    00041                 unsigned int m_rounds;
    00042                 SecBlock<word64> m_key;
    00043         };
    00044
    00045 public:
    00046         typedef BlockCipherFinal<ENCRYPTION, Base> Encryption;
    00047         typedef BlockCipherFinal<DECRYPTION, Base> Decryption;
    00048 };
    00049
    00050 typedef Camellia::Encryption CamelliaEncryption;
    00051 typedef Camellia::Decryption CamelliaDecryption;
    00052
    00053 NAMESPACE_END
    00054
    00055 #endif
    00056
    00057 #endif