Crypto++ 7.0 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
6 #ifndef CRYPTOPP_SKIPJACK_H
7 #define CRYPTOPP_SKIPJACK_H
8
9 #include "seckey.h"
10 #include "secblock.h"
11
12 NAMESPACE_BEGIN(CryptoPP)
13
14 /// \brief SKIPJACK block cipher information
15 struct SKIPJACK_Info : public FixedBlockSize<8>, public FixedKeyLength<10>
16 {
17 CRYPTOPP_DLL static const char * CRYPTOPP_API StaticAlgorithmName() {return "SKIPJACK";}
18 };
19
20 /// \brief SKIPJACK block cipher
21 /// \sa <a href="http://www.cryptopp.com/wiki/SKIPJACK">SKIPJACK</a>
22 class SKIPJACK : public SKIPJACK_Info, public BlockCipherDocumentation
23 {
24 /// \brief SKIPJACK block cipher default operation
25 class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE Base : public BlockCipherImpl<SKIPJACK_Info>
26 {
27 public:
28 void UncheckedSetKey(const byte *userKey, unsigned int length, const NameValuePairs &params);
29 unsigned int OptimalDataAlignment() const {return GetAlignmentOf<word16>();}
30
31 protected:
32 static const byte fTable[256];
33
34 FixedSizeSecBlock<byte, 10*256> tab;
35 };
36
37 /// \brief SKIPJACK block cipher encryption operation
38 class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE Enc : public Base
39 {
40 public:
41 void ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const;
42 private:
43 static const byte Se[256];
44 static const word32 Te[4][256];
45 };
46
47 /// \brief SKIPJACK block cipher decryption operation
48 class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE Dec : public Base
49 {
50 public:
51 void ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const;
52 private:
53 static const byte Sd[256];
54 static const word32 Td[4][256];
55 };
56
57 public:
58 typedef BlockCipherFinal<ENCRYPTION, Enc> Encryption;
59 typedef BlockCipherFinal<DECRYPTION, Dec> Decryption;
60 };
61
62 typedef SKIPJACK::Encryption SKIPJACKEncryption;
63 typedef SKIPJACK::Decryption SKIPJACKDecryption;
64
65 NAMESPACE_END
66
67 #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:15
BlockCipher
Interface for one direction (encryption or decryption) of a block cipher.
Definition: cryptlib.h:1248
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:22
CryptoPP
Crypto++ library namespace.
NameValuePairs
Interface for retrieving values given their names.
Definition: cryptlib.h:293