in reply to Re^3: Base64 and byte arrays
in thread Base64 and byte arrays

If you're going to use string xor, why do it a character at a time?

Why indeed?

use MIME::Base64 qw( decode_base64 ); my $orig = decode_base64( $_ ); $orig ^= substr $orig, 1;
And your solution doesn't work. It appends a junk character.

joec_'s explaination didn't say what to do with the last byte so I left it in.

Replies are listed 'Best First'.
Re^5: Base64 and byte arrays
by ikegami (Patriarch) on Feb 05, 2009 at 05:01 UTC

    There are two possibilities.

    • There's a bug resulting in a byte of information leaking.
    • There's an extra byte that serves as a key.

    The safer bet is the presumption that there is no bug, thus the extra byte is junk. This was confirmed when the OP said my solution worked perfectly.