This is a fictional situation and I don't intend to use a custom crypto implementation in anything serious.

I understand why badly written crypto code can be vulnerable to a lot of attacks. So far the examples I've read about all require the attacker to try different inputs and use data such as the time it takes to encrypt to break the key.

The output from the cipher will be the same on good and bad implémentations of said cipher if it's implemented correctly. Assuming offline encryption and cold storage where the attacker will only get a copy of the encrypted data later, are these attacks really a concern ?

1 Answer 1


Yes. Less of a concern, sure, but what you are describing is a cipher-text-only attack. Absolutely and without a doubt still possible.

I want to split your question into two cases:

1) You write your own implementation of a standardized cipher.

Sure, in this case I agree with you: if you have made an implementation of an algorithm that's faithful to the spec, then your ciphertext by itself will be no easier to break than the ciphertext of any other compliant implementation.

I'd argue you're not really "rolling your own".

Being resistant to side-channel attacks is really more of "hardening" than "rolling your own"; every implementation anywhere could use more hardening. Always.

2) You invent your own cipher or algorithm

Here's where bad things happen. Generally, the attack is frequency analysis - for example if I know that your texts are written in English, then I can start analyzing your ciphertexts looking for patterns that match the distribution of letters in English. If your texts are in XML format, then I can look for the general structure of nested XML blocks, etc.

Never underestimate the cleverness of professional cryptanalysts. Also, never forget Schneier's Law:

Anyone, from the most clueless amateur to the best cryptographer, can create an algorithm that he himself can't break.

Just because you can't break it, doesn't mean nobody can.

  • Not to mention it is not uncommon for home brewed and unaudited code to have a few security vulnerabilities within itself, whether the crypto is crackable or not.
    – SuperAdmin
    Mar 28, 2017 at 22:01
  • @SuperAdmin Sure, but if it's made for offline storage, those issues are moot.
    – forest
    Nov 3, 2018 at 12:36

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .