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