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