Crypto++
skipjack.h
Go to the documentation of this file.
00001 #ifndef CRYPTOPP_SKIPJACK_H
00002 #define CRYPTOPP_SKIPJACK_H
00003 
00004 /** \file
00005 */
00006 
00007 #include "seckey.h"
00008 #include "secblock.h"
00009 
00010 NAMESPACE_BEGIN(CryptoPP)
00011 
00012 //! _
00013 struct SKIPJACK_Info : public FixedBlockSize<8>, public FixedKeyLength<10>
00014 {
00015     CRYPTOPP_DLL static const char * CRYPTOPP_API StaticAlgorithmName() {return "SKIPJACK";}
00016 };
00017 
00018 /// <a href="http://www.weidai.com/scan-mirror/cs.html#SKIPJACK">SKIPJACK</a>
00019 class SKIPJACK : public SKIPJACK_Info, public BlockCipherDocumentation
00020 {
00021     class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE Base : public BlockCipherImpl<SKIPJACK_Info>
00022     {
00023     public:
00024         void UncheckedSetKey(const byte *userKey, unsigned int length, const NameValuePairs &params);
00025         unsigned int OptimalDataAlignment() const {return GetAlignmentOf<word16>();}
00026 
00027     protected:
00028         static const byte fTable[256];
00029 
00030         FixedSizeSecBlock<byte, 10*256> tab;
00031     };
00032 
00033     class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE Enc : public Base
00034     {
00035     public:
00036         void ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const;
00037     private:
00038         static const byte Se[256];
00039         static const word32 Te[4][256];
00040     };
00041 
00042     class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE Dec : public Base
00043     {
00044     public:
00045         void ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const;
00046     private:
00047         static const byte Sd[256];
00048         static const word32 Td[4][256];
00049     };
00050 
00051 public:
00052     typedef BlockCipherFinal<ENCRYPTION, Enc> Encryption;
00053     typedef BlockCipherFinal<DECRYPTION, Dec> Decryption;
00054 };
00055 
00056 typedef SKIPJACK::Encryption SKIPJACKEncryption;
00057 typedef SKIPJACK::Decryption SKIPJACKDecryption;
00058 
00059 NAMESPACE_END
00060 
00061 #endif