←back to thread

358 points impish9208 | 4 comments | | HN request time: 0s | source
Show context
LeifCarrotson ◴[] No.41880363[source]
Interesting how the PKZIP password-protected compressed file is now easily decrypted in <5 minutes, but the original one-time pad is still as mathematically robust as ever.

We could have had a very different history if they'd used DES or RC2 for encryption!

replies(2): >>41880875 #>>41884073 #
rtkwe ◴[] No.41880875[source]
One time pads used properly are theoretically perfectly unbreakable. The problem is making sure no one ever uses the same 'pad'/keystream twice, that your pad generation is actually random, and that the pads never fall into the hands of your adversaries. (or if they do you've been diligent about completely destroying the used pads and the other end of your communications doesn't use the captured set of pads) They're just not very good at anything other than point to point secret passing and require a real world connection to distribute.

So much of symmetric key cryptography is just trying to find creative ways of creating and recreating 'one time pads' so we can distribute the key material instead of the pads themselves.

replies(1): >>41880989 #
janzer ◴[] No.41880989[source]
> that your pad generation is actually random

The one thing that stood out to me with the original blog post and a quick glance at the code was that it appeared as if the pad was certainly not actually random.

Could anyone that has actually understood it a bit more confirm or reject this?

Edit: It seems that the random generation can be found starting here https://github.com/Vulacode/RANDOM/blob/d6a1a1d694b22e6a115b... With three methods, one (RAND2) seems to use the basic interpreter rng more or less directly and the other two seem to be fairly simple prngs seeded from the basic interpreter's rng.

I don't actually know what the state of basic interpreter rngs was in the early '80s but I would be fairly surprised if they're anything that is secure.

replies(2): >>41881412 #>>41886790 #
rtkwe ◴[] No.41881412[source]
At the time PRNG was probably good enough. I wouldn't want to go up against the NSA today using the same entropy source but against South Africa decades ago it was probably good enough. Even knowing what PRNG source the original noise came from it'd take a hell of a lot of guess and check with cribs to come close to guessing the seed for the PRNG. That would be my first crack at breaking a OTP I knew was generated with a particular PRNG at least as a casual student of the craft. Generate huge amount of noise for the possible seeds and see if any names like "Mandela" or other known leaders suddenly pops out of intercepted messages starting at different points in the noise stream (and see if the rest of the message makes any sense when that does happen).
replies(1): >>41881669 #
janzer ◴[] No.41881669[source]
If the PRNG is good enough then shipping floppies full of PRNG output is very much unnecessary. Simply send the seeds used to initialize the PRNG thereby fitting many (~180k of them on a 720kb floppy) seeds on one floppy and save your couriers a lot of risk.
replies(3): >>41882824 #>>41883991 #>>41886028 #
1. kmeisthax ◴[] No.41886028[source]
The problem is that, if you do this, you're not using a one time pad anymore. You're using a stream cipher.

The difference is in the nature of the security guarantees. Almost every cryptographic primitive is "computationally secure", which means the best-known attack is to try every key, and that would take beyond the heat death of the universe. One-time pads have "information-theoretical security", which is that even if you try every possible key, you don't learn the contents of the message, because every possible message has a corresponding decryption key that will produce it from the ciphertext you are trying to break.

The reason why this is the case is because the size of the message space is equal to the size of the key space. In every other cryptosystem, you have a key space that is much smaller than the message space - say, 256 bit AES keys, or 512 bit SHA-2 hashes, for messages that can have many billions of bits in them. It's unlikely for something that wasn't the key to happen to decrypt to a valid-looking message under this scenario. But with a one-time pad, you are actually brute-forcing the message space by brute-forcing the key space. Even if you knew the hash of the plaintext, it wouldn't help. You'd just be brute-forcing whatever hash you used to find collisions.

This property goes away if you start repeating key stream bits by any deterministic process. Hence why just sending a PRNG seed is a bad one-time pad. This is also the difference between /dev/random and /dev/urandom. Linux generates randomness from a PRNG, but it's seeded by unpredictable hardware events and other sources of entropy, and there's a bunch of logic to estimate how much entropy is available. /dev/random specifically blocks until that estimate is positive, so that one-time pads and the like don't repeat bits. (In fact, this is basically the only time you should be using /dev/random! /dev/urandom is perfectly acceptable for all other cryptographic use cases!)

replies(2): >>41886052 #>>41891522 #
2. immibis ◴[] No.41886052[source]
If you generate your OTP beforehand with a PRNG, it's also a stream cipher with extra steps. The real key space is the PRNG seed space, not the size of the key you shipped. Expanding a small key into a big one doesn't make it an OTP - an OTP needs to be actually random.
replies(1): >>41904764 #
3. immibis ◴[] No.41891522[source]
The Linux random devices no longer work the way you describe, either. random blocks until there's enough entropy to consider the PRNG output fully random, then never blocks. urandom simply never blocks, even if there's absolutely no entropy yet and every copy of your device produces the same random stream.
4. rtkwe ◴[] No.41904764[source]
The difficult of stream ciphers is generating good noise 100% predictably. With a one time pad generation you don't need to be able to reliably recreate good noise from the key.

The generator used at the time in BASIC seems to have reseeded the PRNG automatically based on processor time and the checksum of the last block generated by the previous seed so you'd have to use some other source of randomness because you couldn't control that on disparate machines even if you changed the clock on the decoding machine to exactly match the encoding machine at the time of generation.

Instead of just using a statistically useful rand the creator of this would have had to create their own implementation of a stream cipher and that's trusting the NSA hasn't backdoored all of them which was a fear at the time. We're honestly not certain still, though the times that people were most paranoid about like the DES standard it turns out they were actually improving the algorithms resilience.