13 AssertValidKeyLength(keylen);
15 r = GetRoundsAndThrowIfInvalid(params,
this);
18 static const RC6_WORD MAGIC_P = 0xb7e15163L;
19 static const RC6_WORD MAGIC_Q = 0x9e3779b9L;
20 static const int U=
sizeof(RC6_WORD);
22 const unsigned int c =
STDMAX((keylen+U-1)/U, 1U);
28 for (
unsigned j=1; j<sTable.size();j++)
29 sTable[j] = sTable[j-1] + MAGIC_Q;
32 const unsigned n = 3*
STDMAX((
unsigned int)sTable.size(),
c);
34 for (
unsigned h=0;
h < n;
h++)
36 a = sTable[
h % sTable.size()] =
rotlFixed((sTable[
h % sTable.size()] + a +
b), 3);
53 for(
unsigned i=0; i<
r; i++)
59 t =
a; a =
b; b =
c; c =
d; d = t;
80 for (
unsigned i=0; i <
r; i++)
83 t =
a; a =
d; d =
c; c =
b; b = t;
iterator end()
Provides an iterator pointing beyond the last element in the memory block.
void GetUserKey(ByteOrder order, T *out, size_t outlen, const byte *in, size_t inlen)
Utility functions for the Crypto++ library.
T rotlFixed(T x, unsigned int y)
Performs a left rotate.
#define NAMESPACE_BEGIN(x)
BlockGetAndPut< RC6::RC6_WORD, LittleEndian > Block
SecBlock< RC6_WORD > sTable
static GetBlock< T, B, GA > Get(const void *block)
void ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const
Encrypt or decrypt a block.
Access a block of memory.
Classes for the RC6 block cipher.
byte order is little-endian
Classes and functions for secure memory allocations.
iterator begin()
Provides an iterator pointing to the first element in the memory block.
const T & STDMAX(const T &a, const T &b)
Replacement function for std::max.
void ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const
Encrypt or decrypt a block.
T rotlMod(T x, unsigned int y)
Performs a left rotate.
T rotrMod(T x, unsigned int y)
Performs a right rotate.
Interface for retrieving values given their names.