Crypto++  5.6.5
Free C++ class library of cryptographic schemes
rc5.h
Go to the documentation of this file.
1 // rc5.h - written and placed in the public domain by Wei Dai
2 
3 //! \file rc5.h
4 //! \brief Classes for the RC5 block cipher
5 
6 #ifndef CRYPTOPP_RC5_H
7 #define CRYPTOPP_RC5_H
8 
9 #include "seckey.h"
10 #include "secblock.h"
11 
12 NAMESPACE_BEGIN(CryptoPP)
13 
14 //! \class RC5_Info
15 //! \brief RC5 block cipher information
16 //! \since Crypto++ 1.0
17 struct RC5_Info : public FixedBlockSize<8>, public VariableKeyLength<16, 0, 255>, public VariableRounds<16>
18 {
19  CRYPTOPP_STATIC_CONSTEXPR const char* StaticAlgorithmName() {return "RC5";}
20  typedef word32 RC5_WORD;
21 };
22 
23 //! \class RC5
24 //! \brief RC5 block cipher
25 //! \sa <a href="http://www.weidai.com/scan-mirror/cs.html#RC5">RC5</a>
26 //! \since Crypto++ 1.0
27 class RC5 : public RC5_Info, public BlockCipherDocumentation
28 {
29  class CRYPTOPP_NO_VTABLE Base : public BlockCipherImpl<RC5_Info>
30  {
31  public:
32  void UncheckedSetKey(const byte *userKey, unsigned int length, const NameValuePairs &params);
33 
34  protected:
35  unsigned int r; // number of rounds
36  SecBlock<RC5_WORD> sTable; // expanded key table
37  };
38 
39  class CRYPTOPP_NO_VTABLE Enc : public Base
40  {
41  public:
42  void ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const;
43  };
44 
45  class CRYPTOPP_NO_VTABLE Dec : public Base
46  {
47  public:
48  void ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const;
49  };
50 
51 public:
54 };
55 
58 
59 NAMESPACE_END
60 
61 #endif
Provides Encryption and Decryption typedefs used by derived classes to implement a block cipher...
Definition: seckey.h:408
RC5 block cipher.
Definition: rc5.h:27
Classes and functions for secure memory allocations.
Inherited by algorithms with fixed block size.
Definition: seckey.h:40
Inherited by algorithms with variable number of rounds.
Definition: seckey.h:66
Classes and functions for implementing secret key algorithms.
RC5 block cipher information.
Definition: rc5.h:17
Inherited by keyed algorithms with variable key length.
Definition: seckey.h:169
Provides a base implementation of Algorithm and SimpleKeyingInterface for block ciphers.
Definition: seckey.h:311
Crypto++ library namespace.
Interface for retrieving values given their names.
Definition: cryptlib.h:279