Take the 2-minute tour ×
Cryptography Stack Exchange is a question and answer site for software developers, mathematicians and others interested in cryptography. It's 100% free, no registration required.

First of all, I would like to note that I am not building my own crypto. I am simply curious and would like to learn.

What I am wondering is this: if we are worried about randomness of something like a one time pad, why don't we run the pad through a compression process (like bzip) to eliminate any patterns? Wouldn't we essentially then be working with data guaranteed not to have patterns (at least over the chunk size of the compression algorithm)?

Is anyone doing this? Would it even work? If not, why not?

share|improve this question
1  
A bziped file starts 42h 5Ah; not good for a keystream! There are a lot of other redundancy, including markers of compression settings, and at least one error detection code. More generally, for many existing compression algorithms, the output is distinguishable from random even if the input is not; often, the distinguisher can simply be: decompresses without error. –  fgrieu Jul 28 at 4:37

1 Answer 1

up vote 4 down vote accepted

A one time pad (OTP) should by definition not have any patterns. An entropy source can have patterns, but an OTP by definition should consist of pure random bits.

In general you can create something that is close to a true random number generator by applying a cryptographic hash function over the output of an entropy source. According to NIST you should however provide twice the entropy within the input compared with the output. A cryptographic hash function is often referred to as a compression function.

Such a compression function should however not be confused with the underlying compression functions used for creating zip or bzip (etcetera) archives. Those are fully reversible compression functions, and will therefore only add some complexity, not security.

So there is probably somebody doing this, but no, it won't work.

share|improve this answer
1  
This is what I love about StackExchange: a good answer with a clear explanation. Many thanks. I learned something today. –  Bobby Newmark Jul 27 at 19:30

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.