 We have an array of 256 bytes , all different . Every time the array is used it changes by swapping two bytes . The swaps are controlled by counters i and j , each initially 0 . To get a new i , add 1 . To get a new j , add the array byte at the new i . Exchange the array bytes at i and j . The code is the array byte at the sum of the array bytes at i and j . This is <unk> with a byte of the plaintext to encrypt , or the ciphertext to decrypt . The array is initialized by first setting it to 0 through 255 . Then step through it using i and j , getting the new j by adding to it the array byte at i and a key byte , and swapping the array bytes at i and j . Finally , i and j are set to 0 . All additions are modulo 256 . 
