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

rc6.h
Go to the documentation of this file.
1 // rc6.h - originally written and placed in the public domain by Wei Dai
2
3 /// \file rc6.h
4 /// \brief Classes for the RC6 block cipher
5 /// \since Crypto++ 3.0
6
7 #ifndef CRYPTOPP_RC6_H
8 #define CRYPTOPP_RC6_H
9
10 #include "seckey.h"
11 #include "secblock.h"
12
13 NAMESPACE_BEGIN(CryptoPP)
14
15 /// \brief RC6 block cipher information
16 /// \since Crypto++ 3.0
17 struct RC6_Info : public FixedBlockSize<16>, public VariableKeyLength<16, 16, 32, 8>, public VariableRounds<20>
18 {
19 CRYPTOPP_STATIC_CONSTEXPR const char* StaticAlgorithmName() {return "RC6";}
20 typedef word32 RC6_WORD;
21 };
22
23 /// \brief RC6 block cipher
24 /// \sa <a href="http://www.cryptopp.com/wiki/RC6">RC6</a>
25 /// \since Crypto++ 3.0
26 class RC6 : public RC6_Info, public BlockCipherDocumentation
27 {
28 class CRYPTOPP_NO_VTABLE Base : public BlockCipherImpl<RC6_Info>
29 {
30 public:
31 void UncheckedSetKey(const byte *userKey, unsigned int length, const NameValuePairs &params);
32
33 protected:
34 unsigned int r; // number of rounds
35 SecBlock<RC6_WORD> sTable; // expanded key table
36 };
37
38 class CRYPTOPP_NO_VTABLE Enc : public Base
39 {
40 public:
41 void ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const;
42 };
43
44 class CRYPTOPP_NO_VTABLE Dec : public Base
45 {
46 public:
47 void ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const;
48 };
49
50 public:
51 typedef BlockCipherFinal<ENCRYPTION, Enc> Encryption;
52 typedef BlockCipherFinal<DECRYPTION, Dec> Decryption;
53 };
54
55 typedef RC6::Encryption RC6Encryption;
56 typedef RC6::Decryption RC6Decryption;
57
58 NAMESPACE_END
59
60 #endif
BlockCipherDocumentation
Provides Encryption and Decryption typedefs used by derived classes to implement a block cipher...
Definition: seckey.h:398
RC6
RC6 block cipher.
Definition: rc6.h:26
RC6_Info
RC6 block cipher information.
Definition: rc6.h:17
SecBlock< RC6_WORD >
secblock.h
Classes and functions for secure memory allocations.
FixedBlockSize
Inherited by algorithms with fixed block size.
Definition: seckey.h:40
VariableRounds
Inherited by algorithms with variable number of rounds.
Definition: seckey.h:64
seckey.h
Classes and functions for implementing secret key algorithms.
BlockCipherFinal< ENCRYPTION, Enc >
VariableKeyLength
Inherited by keyed algorithms with variable key length.
Definition: seckey.h:165
BlockCipherImpl
Provides a base implementation of Algorithm and SimpleKeyingInterface for block ciphers.
Definition: seckey.h:305
CryptoPP
Crypto++ library namespace.
NameValuePairs
Interface for retrieving values given their names.
Definition: cryptlib.h:293