Site MapJava RC4 Encryption

The Encode and Decode are performed by the same function.
The file is a working example; you only need the RC4 function in your own pages.
I've put a couple of Test Vectors (that don't have nulls in them) in the following Form's code:

Key:   
Message:   



Heres the code:
function RC4(Key, Data) {
     KeyBytes=new Array(255);
  CypherBytes=new Array(255);
  for(i=0; i<256; ++i) {
    KeyBytes[i]=Key.charCodeAt(i % Key.length);
    CypherBytes[i]=i;
  }
  Jump=0;
  for(i=0; i<256; ++i) {
    Jump=(Jump+CypherBytes[i]+KeyBytes[i]) & 0xFF;
    Tmp=CypherBytes[i]; // Swap:
    CypherBytes[i]=CypherBytes[Jump];
    CypherBytes[Jump]=Tmp;
  }
  i=0;
  Jump=0;
  Result="";
  for(X=0; X < Data.length; ++X) {
    i=(i+1) & 0xFF;
    Tmp=CypherBytes[i];
    Jump=(Jump+Tmp) & 0xFF;
    T=(Tmp+CypherBytes[Jump]) & 0xFF;
    CypherBytes[i]=CypherBytes[Jump]; // Swap:
    CypherBytes[Jump]=Tmp;
    Result+=String.fromCharCode(Data.charCodeAt(X)^CypherBytes[T]);
  }
  return Result; 
}