- Main Page
- Namespaces
- Classes
- Files

# shark.h

Go to the documentation of this file.

    00001 #ifndef CRYPTOPP_SHARK_H
    00002 #define CRYPTOPP_SHARK_H
    00003
    00004 /** \file
    00005 */
    00006
    00007 #include "config.h"
    00008 #include "seckey.h"
    00009 #include "secblock.h"
    00010
    00011 NAMESPACE_BEGIN(CryptoPP)
    00012
    00013 //! _
    00014 struct SHARK_Info : public FixedBlockSize<8>, public VariableKeyLength<16, 1, 16>, public VariableRounds<6, 2>
    00015 {
    00016         static const char *StaticAlgorithmName() {return "SHARK-E";}
    00017 };
    00018
    00019 /// <a href="http://www.weidai.com/scan-mirror/cs.html#SHARK-E">SHARK-E</a>
    00020 class SHARK : public SHARK_Info, public BlockCipherDocumentation
    00021 {
    00022         class CRYPTOPP_NO_VTABLE Base : public BlockCipherImpl<SHARK_Info>
    00023         {
    00024         public:
    00025                 void UncheckedSetKey(const byte *key, unsigned int length, const NameValuePairs &param);
    00026
    00027         protected:
    00028                 unsigned int m_rounds;
    00029                 SecBlock<word64> m_roundKeys;
    00030         };
    00031
    00032         class CRYPTOPP_NO_VTABLE Enc : public Base
    00033         {
    00034         public:
    00035                 void ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const;
    00036
    00037                 // used by Base to do key setup
    00038                 void InitForKeySetup();
    00039
    00040         private:
    00041                 static const byte sbox[256];
    00042                 static const word64 cbox[8][256];
    00043         };
    00044
    00045         class CRYPTOPP_NO_VTABLE Dec : public Base
    00046         {
    00047         public:
    00048                 void ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const;
    00049
    00050         private:
    00051                 static const byte sbox[256];
    00052                 static const word64 cbox[8][256];
    00053         };
    00054
    00055 public:
    00056         typedef BlockCipherFinal<ENCRYPTION, Enc> Encryption;
    00057         typedef BlockCipherFinal<DECRYPTION, Dec> Decryption;
    00058 };
    00059
    00060 typedef SHARK::Encryption SHARKEncryption;
    00061 typedef SHARK::Decryption SHARKDecryption;
    00062
    00063 NAMESPACE_END
    00064
    00065 #endif