10#define CRYPTOPP_ENABLE_NAMESPACE_WEAK 1
13NAMESPACE_BEGIN(CryptoPP)
16#if defined(CRYPTOPP_DEBUG) && !defined(CRYPTOPP_DOXYGEN_PROCESSING)
17void ARC4_TestInstantiations()
23ARC4_Base::~ARC4_Base()
39 unsigned int keyIndex = 0, stateIndex = 0;
42 unsigned int a = m_state[i];
43 stateIndex += key[keyIndex] + a;
45 m_state[i] = m_state[stateIndex];
46 m_state[stateIndex] =
byte(a);
47 if (++keyIndex >= length)
56static inline unsigned int MakeByte(T &x, T &y,
byte *s)
58 unsigned int a = s[x];
59 y =
byte((y+a) & 0xff);
60 unsigned int b = s[y];
63 x =
byte((x+1) & 0xff);
64 return s[(a+b) & 0xff];
70 *output++ =
static_cast<byte>(MakeByte(m_x, m_y, m_state));
78 byte *
const s = m_state;
82 if (inString == outString)
86 *outString++ ^= MakeByte(x, y, s);
93 *outString++ = *inString++ ^
byte(MakeByte(x, y, s));
107 byte *
const s = m_state;
108 unsigned int x = m_x;
109 unsigned int y = m_y;
Interface for retrieving values given their names.
CRYPTOPP_DLL int GetIntValueWithDefault(const char *name, int defaultValue) const
Get a named value with type int, with default.
void AssertValidKeyLength(size_t length) const
Validates the key length.
void GenerateBlock(byte *output, size_t size)
Generate random array of bytes.
void DiscardBytes(size_t n)
Generate and discard n bytes.
void UncheckedSetKey(const byte *key, unsigned int length, const NameValuePairs ¶ms)
Sets the key for this object without performing parameter validation.
void ProcessData(byte *outString, const byte *inString, size_t length)
Encrypt or decrypt an array of bytes.
unsigned char byte
8-bit unsigned datatype