[EMAIL PROTECTED] schreef op 18 februari 2002:
> Eugene van der Pijll schreef op 17 februari 2002:
> > 151:
> >
> > sub f{@s[$x,$y]=@s[($y+=$s[$x])%=@s,$x];
> > $s[$x++]+$s[$y]}@k=pop=~/../g;$y+=hex$k[
> > $x%@k],f for@s=0..255;$x=1;$y=0;$x%=@s,p
> > rint$_^chr$s[f()%@s]for<>=~/./g
> 
> I haven't got a clue about RC4,

Neither have I, and I have no way to test them on long data samples, so
test it before you use it...

> but inspecting Eugene's
> masterpiece, can you save a stroke by replacing:
> 
> rint$_^chr$s[f()%@s]for<>=~/./g
> with:
> rint$_^chr$s[255&f]for<>=~/./g

Ah, then I can save another two strokes:

sub f{@s[$x,$y]=@s[($y+=$s[$x])%=@s,$x];
$s[$x++]+$s[$y]-@s}@k=pop=~/../g;$y+=hex
$k[$x%@k],f for@s=0..255;$x=1;$y=0;print
$_^chr$s[f$x%=@s]for<>=~/./g

If you insert a $/=\1; somewhere in the middle, and remove the =~/./g at
the end, it accepts multiline input.

Eugene

Reply via email to