Crypto++
8.2
Free C++ class library of cryptographic schemes
rc5.h
Go to the documentation of this file.
1
// rc5.h - originally 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
/// \brief RC5 block cipher information
15
/// \since Crypto++ 1.0
16
struct
RC5_Info
: public
FixedBlockSize
<8>, public
VariableKeyLength
<16, 0, 255>, public
VariableRounds
<16>
17
{
18
CRYPTOPP_STATIC_CONSTEXPR
const
char
* StaticAlgorithmName() {
return
"RC5"
;}
19
typedef
word32 RC5_WORD;
20
};
21
22
/// \brief RC5 block cipher
23
/// \sa <a href="http://www.cryptopp.com/wiki/RC5">RC5</a>
24
/// \since Crypto++ 1.0
25
class
RC5
:
public
RC5_Info
,
public
BlockCipherDocumentation
26
{
27
class
CRYPTOPP_NO_VTABLE Base :
public
BlockCipherImpl
<RC5_Info>
28
{
29
public
:
30
void
UncheckedSetKey(
const
byte
*userKey,
unsigned
int
length,
const
NameValuePairs
¶ms);
31
32
protected
:
33
unsigned
int
r;
// number of rounds
34
SecBlock<RC5_WORD>
sTable;
// expanded key table
35
};
36
37
class
CRYPTOPP_NO_VTABLE Enc :
public
Base
38
{
39
public
:
40
void
ProcessAndXorBlock(
const
byte
*inBlock,
const
byte
*xorBlock,
byte
*outBlock)
const
;
41
};
42
43
class
CRYPTOPP_NO_VTABLE Dec :
public
Base
44
{
45
public
:
46
void
ProcessAndXorBlock(
const
byte
*inBlock,
const
byte
*xorBlock,
byte
*outBlock)
const
;
47
};
48
49
public
:
50
typedef
BlockCipherFinal<ENCRYPTION, Enc>
Encryption
;
51
typedef
BlockCipherFinal<DECRYPTION, Dec>
Decryption
;
52
};
53
54
typedef
RC5::Encryption
RC5Encryption
;
55
typedef
RC5::Decryption
RC5Decryption
;
56
57
NAMESPACE_END
58
59
#endif
secblock.h
Classes and functions for secure memory allocations.
FixedBlockSize
Inherited by algorithms with fixed block size.
Definition:
seckey.h:40
BlockCipherImpl
Provides a base implementation of Algorithm and SimpleKeyingInterface for block ciphers.
Definition:
seckey.h:305
RC5_Info
RC5 block cipher information.
Definition:
rc5.h:16
BlockCipherDocumentation
Provides Encryption and Decryption typedefs used by derived classes to implement a block cipher.
Definition:
seckey.h:398
seckey.h
Classes and functions for implementing secret key algorithms.
BlockCipherFinal< ENCRYPTION, Enc >
CryptoPP
Crypto++ library namespace.
RC5
RC5 block cipher.
Definition:
rc5.h:25
SecBlock< RC5_WORD >
VariableRounds
Inherited by algorithms with variable number of rounds.
Definition:
seckey.h:64
NameValuePairs
Interface for retrieving values given their names.
Definition:
cryptlib.h:293
VariableKeyLength
Inherited by keyed algorithms with variable key length.
Definition:
seckey.h:165
Generated on Tue Feb 18 2020 03:40:30 for Crypto++ by
1.8.17