lib/normal/rc4a.js
function body(inp, ksa, prga, container, length) {

  var i = 0, j1 = 0, j2 = 0;
  var out = container;
  var s1 = ksa.slice();
  var s2 = prga.slice();
  for (var y = 0; y < length; ++y) {
    i = (i + 1) % 256;
    j1 = (j1 + s1[i]) % 256;
    s1[j1] = [ s1[i], s1[i] = s1[j1] ][0];
    out[y] = inp[y] ^ s2[(s1[i] + s1[j1]) % 256];
    if (++y < length) {
      j2 = (j2 + s2[i]) % 256;
      s2[j2] = [ s2[i], s2[i] = s2[j2] ][0];
      out[y] = inp[y] ^ s1[(s2[i] + s2[j1]) % 256];
    }
  }

  return out;
}
function body(inp, ksa, prga, container, length) {

  var i = 0, j1 = 0, j2 = 0;
  var out = container;
  var s1 = ksa.slice();
  var s2 = prga.slice();
  for (var y = 0; y < length; ++y) {
    i = (i + 1) % 256;
    j1 = (j1 + s1[i]) % 256;
    s1[j1] = [ s1[i], s1[i] = s1[j1] ][0];
    out[y] = inp[y] ^ s2[(s1[i] + s1[j1]) % 256];
    if (++y < length) {
      j2 = (j2 + s2[i]) % 256;
      s2[j2] = [ s2[i], s2[i] = s2[j2] ][0];
      out[y] = inp[y] ^ s1[(s2[i] + s2[j1]) % 256];
    }
  }

  return out;
}
function body ( inp , ksa , prga , container , length ) { var i = 0 , j1 = 0 , j2 = 0 ; var out = container ; var s1 = ksa . slice ( ) ; var s2 = prga . slice ( ) ; for ( var y = 0 ; y < length ; ++ y ) { i = ( i + 1 ) % 256 ; j1 = ( j1 + s1 [ i ] ) % 256 ; s1 [ j1 ] = [ s1 [ i ] , s1 [ i ] = s1 [ j1 ] ] [ 0 ] ; out [ y ] = inp [ y ] ^ s2 [ ( s1 [ i ] + s1 [ j1 ] ) % 256 ] ; if ( ++ y < length ) { j2 = ( j2 + s2 [ i ] ) % 256 ; s2 [ j2 ] = [ s2 [ i ] , s2 [ i ] = s2 [ j2 ] ] [ 0 ] ; out [ y ] = inp [ y ] ^ s1 [ ( s2 [ i ] + s2 [ j1 ] ) % 256 ] ; } } return out ; }
Body cipher.

@function body
@param {Array|Buffer} inp - input
@param {Array} ksa - ksa box
@param {Array} prga - prga box
@param {Array|Buffer} container - out container
@param {Integer} length - limit
@return {Array|Buffer}
Body cipher .