Last active
December 13, 2023 15:02
-
-
Save frohoff/3875a68a9be580a3dee9 to your computer and use it in GitHub Desktop.
terse ruby rc4 (161 chars, 154 chars not counting proc/param overhead) for https://twitter.com/matthew_d_green/status/524966294492577792
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
->t,k{s=*0..255;j=0;m=256;m.times{|i|j=(j+s[i]+k[i%k.size])%m;s[i],s[j]=s[j],s[i]};i=j=0;t.map{|b|i=(i+1)%m;j=(j+s[i])%m;s[i],s[j]=s[j],s[i];b^s[(s[i]+s[j])%m]}} |
Author
frohoff
commented
Oct 22, 2014
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment