# Getting the Encryption Function From the Decryption Function + Decryption Key + Encrypted Item

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.

• 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? Jul 11, 2017 at 1:31
• More like the first choice, reverse-engineering the unknown algorithm from the given inputs. Jul 11, 2017 at 5:33
• 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). Jul 11, 2017 at 8:55

• 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. Jul 11, 2017 at 22:50