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

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

Generated on Mon Apr 19 18:12:33 2004 for Crypto++ by doxygen 1.3.6-20040222