in reply to encryption golf (one time pad)

undef$/;print<>^<>

One the the  <> readlines will read all of the data from all of the files on the command line and the other will return undef so you are xoring everything with nothing leaving the text unchanged.

Update: OK. I missed the scalar context. I was wrong.

Replies are listed 'Best First'.
Re^2: encryption golf (one time pad)
by ikegami (Patriarch) on Mar 17, 2008 at 09:24 UTC
    You should test your claims before contradicting someone.
    >echo abc>corpus >echo def>key >perl -e"undef$/;print<>^<>" corpus key >enc >debug enc -rcx CX 0004 : -d100 l4 0AFB:0100 05 07 05 00 .... -q >perl -e"undef$/;print<>^<>" enc key >dec >type dec abc

    Updated test to include decrpytion.

      I did test and I don't get anything resembling crypto.

        What Perl did you use?
        The OP's code works fine for me with:
        5.8.4 on FreeBSD
        5.6.0 on WinXP (ActivePerl build 623)
        5.6.1 on WinXP (ActivePerl build 635)
        5.8.0 on WinXP (ActivePerl build 806)
        5.8.8 on WinXP (ActivePerl build 817)
        5.10.0 on WinXP (ActivePerl build 1001)

Re^2: encryption golf (one time pad)
by mr_mischief (Monsignor) on Mar 17, 2008 at 09:28 UTC
    Thanks for testing it. On which version of perl on which platform did you find this behavior? It's not consistent with my results on Mandriva Linux with the distro-supplied 5.8.8 nor with 5.10.0 from source nor with Strawberry 5.10.0 on XP.