-
-
Save fwenzel/2b314cc7a1b864c51da1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function*r(k){t=x=>(y=x%n)in s?s[y]:y;w=_=>t((s[i%n]=t(j+=f=t(i++)))+(s[j%n]=f));for(n=256,s=[i=j=0];i<n;)w(j+=k[i%k.length]);for(j=0,i=1;;)yield w()} | |
// A raw RC4 stream. | |
// Works in Firefox only (needs lots of ES6). | |
// 150 chars | |
// Usage: | |
for (var b of r([65,65,65])) { | |
console.log(b); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment