Crypto++ 8.1 Free C++ class library of cryptographic schemes

skipjack.h
Go to the documentation of this file.
1 // skipjack.h - originally written and placed in the public domain by Wei Dai
2
3 /// \file skipjack.h
4 /// \brief Classes for the SKIPJACK block cipher
5 /// \details The Crypto++ implementation conforms to SKIPJACK and KEA
6 /// Algorithm Specifications published by NIST in May 1998. The library passes
7 /// known answer tests available in NIST SP800-17, Table 6, pp. 140-42.
8 /// \sa <a href ="http://csrc.nist.gov/encryption/skipjack/skipjack.pdf">SKIPJACK
9 /// and KEA Algorithm Specifications</a> (May 1998), <a
10 /// href="http://www.cryptopp.com/wiki/SKIPJACK">SKIPJACK</a> on the Crypto++ wiki
11
12 #ifndef CRYPTOPP_SKIPJACK_H
13 #define CRYPTOPP_SKIPJACK_H
14
15 #include "seckey.h"
16 #include "secblock.h"
17
18 NAMESPACE_BEGIN(CryptoPP)
19
20 /// \brief SKIPJACK block cipher information
21 struct SKIPJACK_Info : public FixedBlockSize<8>, public FixedKeyLength<10>
22 {
23 CRYPTOPP_DLL static const char * CRYPTOPP_API StaticAlgorithmName() {return "SKIPJACK";}
24 };
25
26 /// \brief SKIPJACK block cipher
27 /// \details The Crypto++ implementation conforms to SKIPJACK and KEA
28 /// Algorithm Specifications published by NIST in May 1998. The library passes
29 /// known answer tests available in NIST SP800-17, Table 6, pp. 140-42.
30 /// \sa <a href ="http://csrc.nist.gov/encryption/skipjack/skipjack.pdf">SKIPJACK
31 /// and KEA Algorithm Specifications</a> (May 1998), <a
32 /// href="http://www.cryptopp.com/wiki/SKIPJACK">SKIPJACK</a> on the Crypto++ wiki
33 class SKIPJACK : public SKIPJACK_Info, public BlockCipherDocumentation
34 {
35 /// \brief SKIPJACK block cipher default operation
36 class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE Base : public BlockCipherImpl<SKIPJACK_Info>
37 {
38 public:
39 void UncheckedSetKey(const byte *userKey, unsigned int length, const NameValuePairs &params);
40 unsigned int OptimalDataAlignment() const {return GetAlignmentOf<word16>();}
41
42 protected:
43 static const byte fTable[256];
44
45 FixedSizeSecBlock<byte, 10*256> tab;
46 };
47
48 /// \brief SKIPJACK block cipher encryption operation
49 class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE Enc : public Base
50 {
51 public:
52 void ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const;
53 private:
54 static const byte Se[256];
55 static const word32 Te[4][256];
56 };
57
58 /// \brief SKIPJACK block cipher decryption operation
59 class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE Dec : public Base
60 {
61 public:
62 void ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const;
63 private:
64 static const byte Sd[256];
65 static const word32 Td[4][256];
66 };
67
68 public:
69 typedef BlockCipherFinal<ENCRYPTION, Enc> Encryption;
70 typedef BlockCipherFinal<DECRYPTION, Dec> Decryption;
71 };
72
73 typedef SKIPJACK::Encryption SKIPJACKEncryption;
74 typedef SKIPJACK::Decryption SKIPJACKDecryption;
75
76 NAMESPACE_END
77
78 #endif
FixedKeyLength
Inherited by keyed algorithms with fixed key length.
Definition: seckey.h:124
BlockCipherDocumentation
Provides Encryption and Decryption typedefs used by derived classes to implement a block cipher...
Definition: seckey.h:398
SKIPJACK_Info
SKIPJACK block cipher information.
Definition: skipjack.h:21
BlockCipher
Interface for one direction (encryption or decryption) of a block cipher.
Definition: cryptlib.h:1250
secblock.h
Classes and functions for secure memory allocations.
FixedBlockSize
Inherited by algorithms with fixed block size.
Definition: seckey.h:40
seckey.h
Classes and functions for implementing secret key algorithms.
BlockCipherFinal< ENCRYPTION, Enc >
FixedSizeSecBlock< byte, 10 *256 >
BlockCipherImpl
Provides a base implementation of Algorithm and SimpleKeyingInterface for block ciphers.
Definition: seckey.h:305
SKIPJACK
SKIPJACK block cipher.
Definition: skipjack.h:33
CryptoPP
Crypto++ library namespace.
NameValuePairs
Interface for retrieving values given their names.
Definition: cryptlib.h:293