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

3way.h

Go to the documentation of this file.
00001 #ifndef CRYPTOPP_THREEWAY_H 00002 #define CRYPTOPP_THREEWAY_H 00003 00004 /** \file 00005 */ 00006 00007 #include "seckey.h" 00008 #include "secblock.h" 00009 00010 NAMESPACE_BEGIN(CryptoPP) 00011 00012 struct ThreeWay_Info : public FixedBlockSize<12>, public FixedKeyLength<12>, public VariableRounds<11> 00013 { 00014 static const char *StaticAlgorithmName() {return "3-Way";} 00015 }; 00016 00017 /// <a href="http://www.weidai.com/scan-mirror/cs.html#3-Way">3-Way</a> 00018 class ThreeWay : public ThreeWay_Info, public BlockCipherDocumentation 00019 { 00020 class Base : public BlockCipherBaseTemplate<ThreeWay_Info> 00021 { 00022 public: 00023 void UncheckedSetKey(CipherDir direction, const byte *key, unsigned int length, unsigned int rounds); 00024 00025 protected: 00026 unsigned int m_rounds; 00027 FixedSizeSecBlock<word32, 3> m_k; 00028 }; 00029 00030 class Enc : public Base 00031 { 00032 public: 00033 void ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const; 00034 }; 00035 00036 class Dec : public Base 00037 { 00038 public: 00039 void ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const; 00040 }; 00041 00042 public: 00043 typedef BlockCipherTemplate<ENCRYPTION, Enc> Encryption; 00044 typedef BlockCipherTemplate<DECRYPTION, Dec> Decryption; 00045 }; 00046 00047 typedef ThreeWay::Encryption ThreeWayEncryption; 00048 typedef ThreeWay::Decryption ThreeWayDecryption; 00049 00050 NAMESPACE_END 00051 00052 #endif

Generated on Fri Aug 13 09:56:52 2004 for Crypto++ by doxygen 1.3.7