Aristarkh A Zagorodnikov wrote: > > > > > On 24 Aug 2001 19:01:58 +0900, martin / zsdfherg.com wrote: > > > Hi, > > > > > > This will likely turn out to be a dumb question, but is there any way to > > > decrypt a string encrypted using String#crypt? > > > Use RC4 algorithm by Ron Rivest. In Ruby it's only four lines of code: s, j, k = (0..255).to_a, 0, (ARGV[0]*256)[0,256].unpack('C*') (0..255).each{|x| j = (j + s[x] + k[x]) % 256; s[x], s[j] = s[j], s[x] } i = j = 0; $stdin.each_byte{|b| i = (i + 1) % 256; j = (j + s[i]) % 256 s[i], s[j] = s[j], s[i]; $stdout<<(b ^ s[(s[i] + s[j])%256]).chr } This takes a string as parameter and encrypts/decrypts stdin to stdout. Ha, Perl's version takes 3-4 lines, too. RC4 is very simple to implementing but it is said to be insecure (whatever that means). Regards, Michael -- Michael Neumann merlin.zwo InfoDesign GmbH http://www.merlin-zwo.de