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