Correct me if I'm wrong but since the cryptographic algorithm is open source, doesn't it mean that everyone who can access the code would be able to crack it?

I'm probably wrong since there are many successful open source algorithms but how does this prevent attackers from cracking the algorithm? Could anyone go over this concept for me?


4 Answers 4


Many encryption systems in the 20th century used to rely on obscurity of the algorithm. This was a bad approach, as you have to keep the whole program secret, which is technically impossible if you want to distribute the program. If someone obtains a copy of the program, then you have to rewrite the program.

In 21st century encryption, the only secret is your password. Even non-open source programs use algorithms that are public. The strength of encryption lies in the ability to protect data using only your password.

Cryptographer Bruce Schneier explains:

Every secret creates a potential failure point. Secrecy, in other words, is a prime cause of brittleness—and therefore something likely to make a system prone to catastrophic collapse. Conversely, openness provides ductility.

Open source encryption is thus often more secure than non-open source encryption.

  • So if you wish, the password or key file is closed source.
    – Turion
    Jun 24, 2015 at 14:24
  • 1
    Obligatory link: en.wikipedia.org/wiki/Kerckhoffs%27s_principle - which is 19th century, so we've had opinion that public algorithms are better in theory for a lot longer than electronic computers have been around to implement them. (Edit: Oh I see that you have linked "security through obscurity" which is much the same and cross-links Kerchoff's principle article, so this not really necessary :-) Sep 21, 2015 at 8:16
  • @NeilSlater: Actually my second paragraph contains your obligatory link :-) Sep 24, 2015 at 6:56
  • 2
    Sorry I completely failed to notice that! Well at least I noticed how old Kerchoff's principle is. It does seem to take constant re-discovery and re-stating. I wonder when it became "canon" (if that's the right word) for modern cryptography? Perhaps a follow-up question . . . Sep 24, 2015 at 7:14
  • Follow-up question: crypto.stackexchange.com/questions/29364/… Sep 24, 2015 at 7:38

The reason open cryptography is considered safer than its closed alternatives is because open cryptography is open to reviews and auditing from security experts all over the world.

Closed algorithms are subject to internal company reviews, and paid experts reviews only. Which, by definition, is a small set than "security experts all over the world".

The old notion was that the more secrecy you have in your application, the safer it is. "If an attacker can't see my code, he won't be able to attack me" or "If an attacker doesn't know which algorithms I'm using, he won't be able to brute force against me". Both of these have been proven wrong with timing attacks and rainbow tables.

A good algorithm is public and open, the only secret thing is the private key or the shared secret (like a password).


Even if your algorithm is in the open, each user keeps a secret: the password (or other secret that is used as key to en- and decryption). You want that the algorithm works safe, even if it is known. Because it is always possible through decompiling to get the algorithm.

Why is the algorithm safe even if it is known? Because it works with mathematics, that need to much time decrypting it without the personal secret it was encrypted with. How that works in detail is out of the scope here, you should ask that on crypto.se or security.se.

So having the implementation (and thus the algorithm) out in the open is no downside. But it is even an upside. Many algorithms people came up with over time are flawed or easy to break with current technology (Cesar-cipher for example). If you use that even closed source, it is easy to detect it and break it. Even more: if you use a well-known and good algorithm, there are many points at which you can fail at implementation and make the whole software unsecure. Look at the details of the Debian-OpenSSL-bug for an example. So, having your code in the open allows experts to analyze it, and they usually make it public if they find bugs in the implementation. If they can't access the code, they cannot do that. So I would trust an Open-Source crypto that has no known bugs or is broadly criticized more than an Closed source program that might or might not have a good implementation. Naturally you should avoid both open source and closed source crypto with known problems.


It's not only about OSS crypto is safer than non-opensource crypto, it's about the algorithm you are using. It's very easy to build up an encryption algorithm at your own and it's very easy to fail complete while doing it. A good example is Mifare Classic. So using a public and proofed algorithm can save you some headage. Good algorithm splitting up the logic and the key for it, so you don't have to worry about. Let's make an example: Everybody is knowing how a lock is working, but without the correct key you most likely won't be able to enter. It's the same on good crypto.

However, it's also quiet easy to implement a good standard in a very poor way or with failures. This is what we have seen recently with openssl. It might be a simple failure or while acting in bad faith. Here opensource can help to find bugs and fix them faster than hiding your code.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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