lib/normal/rc4a.js
function gPrga(key, s) {

  var keystream = [];
  var k = 0;
  var j = 0;
  var len = key.length;
  for (var i = 0; i < len; ++i) {
    k = (k + 1) % 256;
    j = (j + s[k]) % 256;
    s[j] = [ s[k], s[k] = s[j] ][0];
    keystream[i] = s[(s[k] + s[j]) % 256];
  }

  return keystream;
}
function gPrga(key, s) {

  var keystream = [];
  var k = 0;
  var j = 0;
  var len = key.length;
  for (var i = 0; i < len; ++i) {
    k = (k + 1) % 256;
    j = (j + s[k]) % 256;
    s[j] = [ s[k], s[k] = s[j] ][0];
    keystream[i] = s[(s[k] + s[j]) % 256];
  }

  return keystream;
}
function gPrga ( key , s ) { var keystream = [ ] ; var k = 0 ; var j = 0 ; var len = key . length ; for ( var i = 0 ; i < len ; ++ i ) { k = ( k + 1 ) % 256 ; j = ( j + s [ k ] ) % 256 ; s [ j ] = [ s [ k ] , s [ k ] = s [ j ] ] [ 0 ] ; keystream [ i ] = s [ ( s [ k ] + s [ j ] ) % 256 ] ; } return keystream ; }
Generate PRGA.

@function gPrga
@param {Array} key - user key
@param {Array} s - s1 vector
@return {Array}
Generate PRGA .