Skip to content

Instantly share code, notes, and snippets.

@farhadi
farhadi / rc4.js
Created March 24, 2012 17:09
RC4 encryption in javascript and php
/*
* RC4 symmetric cipher encryption/decryption
*
* @license Public Domain
* @param string key - secret key for encryption/decryption
* @param string str - string to be encrypted/decrypted
* @return string
*/
function rc4(key, str) {
var s = [], j = 0, x, res = '';