Is it mathematically possible to always be able to get the encryption algorithm used to encrypt a certain item (file, number, text, ...etc.) by knowing the decryption algorithm that will be used to decrypt that item, the encryption key (i.e. private key), and (of course) the encrypted item itself? I.e. are all encryption algorithms reversible and have this hypothetical equality hold (going to left decryption, while going to right is encryption), while still being able to get the method to go either way (right or left) if I know the other way: encrypted item + key <=> decrypted item? I am referring to reverse engineering an encryption/decryption algorithm from knowing the other one in both symmetric and asymmetric encryption/decryption algorithms.

  • $\begingroup$ I'm not sure if others can understand this question clearly. Are you trying to explore the possibility of reverse-engineering a certain unknown algorithm, or are you confused with encryption algorithm and encryption key? Can you clarify? $\endgroup$
    – DannyNiu
    Commented Jul 11, 2017 at 1:31
  • $\begingroup$ More like the first choice, reverse-engineering the unknown algorithm from the given inputs. $\endgroup$
    – falhumai96
    Commented Jul 11, 2017 at 5:33
  • $\begingroup$ knowing the decryption algorithm – Most probably yes, assuming we're talking about modern algorithms (to clarify: are we?) as those tend to be publically published. Therefore, filling in the encryption blank is pretty easy. As for your question in general, it "feels" a bit broad… yet, that might just be me, thinking about too many details I'ld want to mention in an answer (which is why I refrain from posting one). $\endgroup$
    – e-sushi
    Commented Jul 11, 2017 at 8:55

1 Answer 1


Every encryption is reversible, that's why most security relies on hashing in place of encryption.

  • 1
    $\begingroup$ Can you clarify where well-vetted ciphers like AES rely on “hashing” instead of “encryption”? $\endgroup$
    – e-sushi
    Commented Jul 11, 2017 at 12:09
  • $\begingroup$ I know almost nothing about AES. This seemed like a very broad question, so I gave a very broad answer. Generally, tho, any algorithm that relies on obfuscation/substitution can be reversed, where as algorithms that are closer to pseudo-random generators dependant on one way functions are not. $\endgroup$
    – That Guy
    Commented Jul 11, 2017 at 15:52
  • $\begingroup$ Feistel networks can be reverted (to name one of many), since the one-way function(s) they pull their security from is nicely wrapped up in their $f$ function(s). Also, I wouldn't really call a one-liner a very broad answer. That was one of the reasons I asked if you could clarify… hoping you would edit the answer and expand a bit on it. $\endgroup$
    – e-sushi
    Commented Jul 11, 2017 at 22:50
  • $\begingroup$ I'm sure there are plenty of exceptions to the rule, and I'm sure you can name most of them. I gave a general answer to a general question that I feel is appropriate both in content and delivery. The OP is clearly new, there is no need to split hairs. $\endgroup$
    – That Guy
    Commented Jul 11, 2017 at 22:54
  • 1
    $\begingroup$ Just saying it wouldn't hurt to add a bit of "meat" to the answer so that it reads less like a comment and OP is able to draw more information from it. After all, OP - if indeed new to crypto - most probably asked to learn something. That's why we tend to explain things when providing answers… and, whenever possible and/or appropriate, add references to it so that askers can dive into additional information if they like. Not saying you have to do the same. I'm merely trying to help you make your answer better (which attracts upvotes) and more helpful to OP (which is Crypto.SE's core purpose). $\endgroup$
    – e-sushi
    Commented Jul 11, 2017 at 23:02

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.