Nice job, everyone!
Here's my latest version at 144...thing is it's odd, doesn't 'look' like
it should work yet it does, I've tested encrypting and decrypting all
types of binary files and just plain text and never a problem..also
tried all kinds of keys up to 128bits - any ideas? some more info on
oddness below
So at 144:
sub f{@s[$x,$y]=@s[($y+=$s[$x])%=@s,$x];
$s[$x++]+$s[$y]-@s}@k=pop=~/../g;
f$y+=hex$k[$x%@k]for@s=0..255;$x=1;
$y=$/=\1;print$_^chr$s[f$x%=@s]for<>
I'm using $/=\1; for multi-line input (and got rid of the =~/./g to keep
the same size) but instead of having $y=0; I'm doing $y=$/=\1;
$y=\1 is a scalar and $y+0 becomes a nice, long number..but still, no probs
Even more strange, if I stick nothing but a print"$y"; inside of the
sub, the program ceases to encrypt correctly. But if I do a print $y;
it works fine! It has to do with the quotes because a print ""; will
mess it up, as will a print ''; but a print; won't...ideas?
-Samy
Rocco Caputo wrote:
> The full version is at 146:
>
> sub f{@s[$x,$y]=@s[($y+=$s[$x])%=@s,$x];
> $s[$x++]+$s[$y]-@s}@k=pop=~/../g;f$y+=he
> x$k[$x%@k]for@s=0..255;$x=1;$y=0;print$_
> ^chr$s[f$x%=@s]for<>=~/./g
>
> -- Rocco Caputo / [EMAIL PROTECTED] / poe.perl.org / poe.sf.net
>
>
>
--
Samy Kamkar -- (877) 898-1424 -- [EMAIL PROTECTED]
LucidX.com / cobra.LucidX.com / LA.pm.org / code.LucidX.com