in reply to xor encrypt-decrypt routine

Loop to length($_) - 1. The second argument to substr() is an *offset*. If there are 32 characters in the string, the offsets run from 0 to 31.

That may not solve the entire issue, because I'm not sure if you get carriage returns when reading in a file on Windows. If you're not on Windows, it doesn't matter.

Either way, you'll get one good line, then an extra character that throws off your key, and everything else will be garbage after that.

Replies are listed 'Best First'.
Re: Re: xor encrypt-decrypt routine
by Anonymous Monk on Jan 21, 2001 at 18:49 UTC
    Ahh, that did the trick. I simply changed the loop to:
    for my $i (0..(length($_) -1)) { ...
    and it worked like a charm. I'm not running Windows so I didn't get bitten by any carrige returns. Thanks!