- Main Page
- Namespaces
- Classes
- Files

# 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 //! _
    00013 struct ThreeWay_Info : public FixedBlockSize<12>, public FixedKeyLength<12>, public VariableRounds<11>
    00014 {
    00015         static const char *StaticAlgorithmName() {return "3-Way";}
    00016 };
    00017
    00018 /// <a href="http://www.weidai.com/scan-mirror/cs.html#3-Way">3-Way</a>
    00019 class ThreeWay : public ThreeWay_Info, public BlockCipherDocumentation
    00020 {
    00021         class CRYPTOPP_NO_VTABLE Base : public BlockCipherImpl<ThreeWay_Info>
    00022         {
    00023         public:
    00024                 void UncheckedSetKey(const byte *key, unsigned int length, const NameValuePairs &params);
    00025
    00026         protected:
    00027                 unsigned int m_rounds;
    00028                 FixedSizeSecBlock<word32, 3> m_k;
    00029         };
    00030
    00031         class CRYPTOPP_NO_VTABLE Enc : public Base
    00032         {
    00033         public:
    00034                 void ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const;
    00035         };
    00036
    00037         class CRYPTOPP_NO_VTABLE Dec : public Base
    00038         {
    00039         public:
    00040                 void ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const;
    00041         };
    00042
    00043 public:
    00044         typedef BlockCipherFinal<ENCRYPTION, Enc> Encryption;
    00045         typedef BlockCipherFinal<DECRYPTION, Dec> Decryption;
    00046 };
    00047
    00048 typedef ThreeWay::Encryption ThreeWayEncryption;
    00049 typedef ThreeWay::Decryption ThreeWayDecryption;
    00050
    00051 NAMESPACE_END
    00052
    00053 #endif