16#if defined(CRYPTOPP_DEBUG) && !defined(CRYPTOPP_DOXYGEN_PROCESSING) 
   17void ARC4_TestInstantiations()
 
   23ARC4_Base::~ARC4_Base()
 
   28void ARC4_Base::UncheckedSetKey(
const byte *key, 
unsigned int length, 
const NameValuePairs ¶ms)
 
   30    AssertValidKeyLength(length);
 
   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)
 
   52    DiscardBytes(discardBytes);
 
   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];
 
   67void ARC4_Base::GenerateBlock(
byte *output, 
size_t size)
 
   70        *output++ = 
static_cast<byte>(MakeByte(m_x, m_y, m_state));
 
 
   73void ARC4_Base::ProcessData(
byte *outString, 
const byte *inString, 
size_t length)
 
   78    byte *
const s = m_state;
 
   82    if (inString == outString)
 
   86            *outString++ ^= MakeByte(x, y, s);
 
   93            *outString++ = *inString++ ^ 
byte(MakeByte(x, y, s));
 
 
  102void ARC4_Base::DiscardBytes(
size_t n)
 
  107    byte *
const s = m_state;
 
  108    unsigned int x = m_x;
 
  109    unsigned int y = m_y;