How Can you find the key if you encrypted and decrypted data?

If we encrypt "my secret1" and get "Q52vAsLfzoFEnQ"
and  encrypt "my secret2"  and get "F52vHsLfzoOEnF"

from these result Can We find the encrypted KEY?
 or Can we encrypt "my secret3" without knowing the KEY?
Thank you

PS If you have code examples, I prefer VB
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Also, I must question why you are asking this. Why do you need this?

Anyway, when researching this further you will probably find out by yourself what I'm going to tell. No big secrets here.
What you are referring to is cryptanalysis. Trying to find the key from known plaintext is called a 'known-plaintext attack'. Logical eh?
If you have access to the encryption algorithm but not the key you could try a Differential or Linear Cryptanalysis.
Encrypting without knowing the key is near to impossible.
You will need to have a deep understanding of cryptography to pull off something like this.
E.g. understand the difference between transposition and substitution, symmetric and asymmetric, block and stream ciphers, how s-boxes work, with IV's are etc ...
A lot of study work.
And the algorithm used must be breakable. From the looks of your example, there seems to be not much randomness in the resulting ciphertext.
Probably not a well established algorithm, but I could be fooled from one sample :-)
I won't give you more info without knowing your motifs. And as I can't verify those on such a forum, don't bother to ask any further.

For an intro to cryptography:
For an intro and vb example, have a look at:
Of course, the site of the NIST also has a lot of information:


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
The simple answer is "you can't!"  Unless, of course, a lame encryption algorithm is being used.  The whole idea behind solid encrpytion is to make key recovery nearly impossible no matter what.  The situation you've described is a classic cryptography problem, where the hacker has gained the ability to encrypt whatever messages he wants and see the result.  But cryptosystems are designed to PREVENT recovery of the key in such situations.

On a practical side, however.  The above encryption scheme appears to my eyes to be "lame" since there is clearly a relationship between the two encrypted strings.

The answer is: Maybe. And the maybe depends on the encryption algorithm that you use. For instance, if you use Base64 encryption, yes; you can find online decryptors on the web or you decrypt it yourself. Otherwise, you will not be able to decrypt it.

Look at it this way. you but two Lock/Key from the store; both same brand. Key 1 locks Lock1, and Key 2 locks Lock2. you know how the Key/Lock operates and you can see the key on your hand. But, can you fnd out how the 'cams' are placed to open the lock? The answer is no, unless the lock is using a very weak combination (or flat key, for example).

Also , there are many encryption algorithms that they don't even send the key over the wire.

hope this clears up.
ON-DEMAND: 10 Easy Ways to Lose a Password

Learn about the methods that hackers use to lift real, working credentials from even the most security-savvy employees in this on-demand webinar. We cover the importance of multi-factor authentication and how these solutions can better protect your business!

All that's been needed to be said has been said. Weak algorithms would make it fairly easy... many more attacks tend to try to trick other machines into doing the work for them.

But I would have to agree with why you'd want to do this? Don't get me wrong, it's a great thing to try to study to cryptography and to seek out the weaknesses in a given algorithm, but your question as it's posed leaves me wondering the actual intent.

But to stick with your question, you would have to guess the algorithm used in order to be able to do anything. But also, you'd have to try to figure out what keys were used assuming there was a key. So it's really not necessarily a matter of a yes/no, do it this way method. You have to analyze the algorithm for patterns, then try to work out some fairly complex math.
The point of the encryption/decryption is to not to be able to reveal
the key of the encryption. You can try manually guessing or get some
brute force cracking tools that'll try that instead, but the answer to your
question is "it cannot be done easily, but yes, it can be done."
it can be but depending on the encryption you may have to try every key for the next whatever years. For instance, trying to guess a password with 8 digit can take you up to 6,553,600,000,000 tries.
udanabananaAuthor Commented:
Thnks for the support. This did help me. The sample I used is just generated one.. not actual. I just want verify how secure is my system.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.