RC5 encryption and decryption class.
More...
#include <rc5.hpp>
|
| RC5 (uint32_t rounds=12, uint32_t wordSize=32, uint32_t blockSize=16) |
| Constructs an RC5 object. More...
|
|
void | encrypt (uint32_t &A, uint32_t &B) |
| Encrypts the given block. More...
|
|
void | decrypt (uint32_t &A, uint32_t &B) |
| Decrypts the given block. More...
|
|
|
uint32_t | rotl (uint32_t value, uint32_t shift) |
|
uint32_t | rotr (uint32_t value, uint32_t shift) |
|
void | init () |
|
|
uint32_t | w |
|
uint32_t | r |
|
uint32_t | b |
|
std::vector< uint32_t > | S |
|
const uint32_t | P = 0xB7E15163 |
|
const uint32_t | Q = 0x9E3779B9 |
|
RC5 encryption and decryption class.
Definition at line 47 of file rc5.hpp.
◆ RC5()
gpmp::nt::RC5::RC5 |
( |
uint32_t |
rounds = 12 , |
|
|
uint32_t |
wordSize = 32 , |
|
|
uint32_t |
blockSize = 16 |
|
) |
| |
Constructs an RC5 object.
- Parameters
-
rounds | Number of rounds |
wordSize | Size of the word in bits |
blockSize | Size of the block in bytes |
Definition at line 36 of file rc5.cpp.
37 :
w(wordSize),
r(rounds),
b(blockSize) {
References init().
◆ decrypt()
void gpmp::nt::RC5::decrypt |
( |
uint32_t & |
A, |
|
|
uint32_t & |
B |
|
) |
| |
Decrypts the given block.
- Parameters
-
A | First half of the block |
B | Second half of the block |
Definition at line 58 of file rc5.cpp.
59 for (uint32_t i =
r; i > 0; --i) {
uint32_t rotr(uint32_t value, uint32_t shift)
std::vector< uint32_t > S
References python.linalg::A, and python.linalg::B.
◆ encrypt()
void gpmp::nt::RC5::encrypt |
( |
uint32_t & |
A, |
|
|
uint32_t & |
B |
|
) |
| |
Encrypts the given block.
- Parameters
-
A | First half of the block |
B | Second half of the block |
Definition at line 49 of file rc5.cpp.
52 for (uint32_t i = 1; i <=
r; ++i) {
uint32_t rotl(uint32_t value, uint32_t shift)
References python.linalg::A, and python.linalg::B.
◆ init()
void gpmp::nt::RC5::init |
( |
| ) |
|
|
private |
Definition at line 41 of file rc5.cpp.
44 for (uint32_t i = 1; i < 2 *
r + 2; ++i) {
Referenced by RC5().
◆ rotl()
uint32_t gpmp::nt::RC5::rotl |
( |
uint32_t |
value, |
|
|
uint32_t |
shift |
|
) |
| |
|
private |
Definition at line 67 of file rc5.cpp.
68 return (value << shift) | (value >> (
w - shift));
◆ rotr()
uint32_t gpmp::nt::RC5::rotr |
( |
uint32_t |
value, |
|
|
uint32_t |
shift |
|
) |
| |
|
private |
Definition at line 71 of file rc5.cpp.
72 return (value >> shift) | (value << (
w - shift));
uint32_t gpmp::nt::RC5::b |
|
private |
const uint32_t gpmp::nt::RC5::P = 0xB7E15163 |
|
private |
const uint32_t gpmp::nt::RC5::Q = 0x9E3779B9 |
|
private |
uint32_t gpmp::nt::RC5::r |
|
private |
std::vector<uint32_t> gpmp::nt::RC5::S |
|
private |
uint32_t gpmp::nt::RC5::w |
|
private |
The documentation for this class was generated from the following files: