7

Many files begin with a "well-known" header sequence which I imagine helps a lot in performing cryptanalysis over a huge number of data transfers.

So I have the thought of prepending a block or two of random data to make cryptanalysis more difficult.

Let's say that the file is like this:

<Header 250 bytes><Contents>

So we prepend some random data (of random length) like this:

<Random data of random length><Magic Number><Header 250 bytes><Contents>

The receiving side, after decrypting, simply scans for <Magic Number> and snips everything up to that point.

Since the length is random, the attacker won't be able to guess where exactly the well-known parts will be.

Do you think this is a good idea? Or too much effort for not enough improvement?

  • 1
    Are you trying to make cryptanalysis (analysis of weaknesses in the cipher algorithm itself) harder, or are you trying to make brute force or dictionary attacks (which attempt to guess the key) slower? – forest Feb 23 at 6:43
  • 7
    Well done for asking instead of just assuming you’ve come up with a brilliant technique for enhanced cryptographic security that needs no review (as too many have done). – Wildcard Feb 23 at 7:03
10

No, this won't provide any improvement for encryption with any decent cipher. If a cipher is so bad that a known-plaintext attack is capable of fatally breaking it, then the cipher is worthless. A known-plaintext attack is one where an attacker has knowledge of plaintext/ciphertext pairs and, from that knowledge, is able to either calculate the key or otherwise perform decryption operations on arbitrary ciphertext.

If you want to make decryption via brute force or dictionary attacks harder, you should use a KDF like Argon2 that runs the user-specified password through a computation-intensive and memory-intensive calculation before it is fed to the cipher. If you want to make cryptanalysis of the cipher more difficult, all you need to do is use a cryptography library that selects a secure cipher for you, like AES or ChaCha.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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