37 : w(wordSize), r(rounds), b(blockSize) {
44 for (uint32_t i = 1; i < 2 * r + 2; ++i) {
52 for (uint32_t i = 1; i <= r; ++i) {
53 A = rotl((
A ^
B),
B) + S[2 * i];
54 B = rotl((
B ^
A),
A) + S[2 * i + 1];
59 for (uint32_t i = r; i > 0; --i) {
60 B = rotr(
B - S[2 * i + 1],
A) ^
A;
61 A = rotr(
A - S[2 * i],
B) ^
B;
68 return (value << shift) | (value >> (w - shift));
72 return (value >> shift) | (value << (w - shift));
uint32_t rotr(uint32_t value, uint32_t shift)
void decrypt(uint32_t &A, uint32_t &B)
Decrypts the given block.
void encrypt(uint32_t &A, uint32_t &B)
Encrypts the given block.
RC5(uint32_t rounds=12, uint32_t wordSize=32, uint32_t blockSize=16)
Constructs an RC5 object.
uint32_t rotl(uint32_t value, uint32_t shift)