1#ifndef CRYPTOPP_SKIPJACK_H
2#define CRYPTOPP_SKIPJACK_H
3
4/** \file
5*/
6
7#include "seckey.h"
8#include "secblock.h"
9
10NAMESPACE_BEGIN(CryptoPP)
11
12//! _
13struct SKIPJACK_Info : public FixedBlockSize<8>, public FixedKeyLength<10>
14{
15	CRYPTOPP_DLL static const char * CRYPTOPP_API StaticAlgorithmName() {return "SKIPJACK";}
16};
17
18/// <a href="http://www.weidai.com/scan-mirror/cs.html#SKIPJACK">SKIPJACK</a>
19class SKIPJACK : public SKIPJACK_Info, public BlockCipherDocumentation
20{
21	class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE Base : public BlockCipherImpl<SKIPJACK_Info>
22	{
23	public:
24		void UncheckedSetKey(const byte *userKey, unsigned int length, const NameValuePairs &params);
25		unsigned int OptimalDataAlignment() const {return GetAlignmentOf<word16>();}
26
27	protected:
28		static const byte fTable[256];
29
30		FixedSizeSecBlock<byte[256], 10> tab;
31	};
32
33	class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE Enc : public Base
34	{
35	public:
36		void ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const;
37	private:
38		static const byte Se[256];
39		static const word32 Te[4][256];
40	};
41
42	class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE Dec : public Base
43	{
44	public:
45		void ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const;
46	private:
47		static const byte Sd[256];
48		static const word32 Td[4][256];
49	};
50
51public:
52	typedef BlockCipherFinal<ENCRYPTION, Enc> Encryption;
53	typedef BlockCipherFinal<DECRYPTION, Dec> Decryption;
54};
55
56typedef SKIPJACK::Encryption SKIPJACKEncryption;
57typedef SKIPJACK::Decryption SKIPJACKDecryption;
58
59NAMESPACE_END
60
61#endif
62