open$a,shift;open$b,shift;$|=1<<4<<8;print$^A^$^L while read$a,$^A,$|& +& read$b,$^L,$|
My first obfu...please be gentle. Runs under warnings and strict. Usage: Provide two files and it'll spit out the encrypted output to standard out. To recover either of the original files, provide the encrypted text with the other file. For instance, if you ran the script on files foo and bar originally and saved the output in baz, you would recover foo by running the script on bar and baz. Similarly, you would recover bar by running against foo and baz.

thor

Replies are listed 'Best First'.
Re: Unbreakable crypto
by rob_au (Abbot) on May 19, 2004 at 07:42 UTC
    Whilst this obfuscation did not produce the described output on my system (Mac OS X 10.3.3 with standard shipping build of perl 5.8.1RC3), I would note that bit-shift encryption, whilst often a component of other ciphers, by itself is not unbreakable. This is particularly true in this implementation as the supplied code represents an symmetric cryptographic implementation necessitating the transfer of keys for decryption.

     

    perl -le "print unpack'N', pack'B32', '00000000000000000000001011011011'"

      One time pads are the only information theoretically secure cipher. Of course, the devil's in the details. The key has to be truly random. There is the issue of key exchange. But, once you meet these requirements, there is no way to break a one time pad. All possible decryptions with the same length as the message are equally likely, so how do you know that you know that a given 6-letter string decrypts to "rob_au" vs "chester"?

      thor

        Because "chester" is 7 letters?

        The PerlMonk tr/// Advocate

        All possible decryptions with the same length as the message are equally likely

        This is one property of OTPs that I think is often overlooked for practical applications. This could be used for plausible deniability reasons. For instance, say you took the source code to a DeCSS program and a letter to your Grandma, which are both exactly the same length. You then generate a random string of characters, also of the same length. There exist two seperate OTP keys for that character stream, one of which will decrypt the stream into the DeCSS source and the other into the letter. Generating these keys is as simple as XOR'ing the stream against the document. If you get caught, you can give the authorities the key for the letter, and they thus have no evidiance. You can then walk away and give your freinds the key for the source code.

        ----
        send money to your kernel via the boot loader.. This and more wisdom available from Markov Hardburn.