Author

Topic: Question about encrypting a message (Read 263 times)

legendary
Activity: 2030
Merit: 1189
August 13, 2020, 12:34:33 PM
#7
There is nothing more to add to this thread apart from all the nice explanations you have here.

But I would suggest you to read this thread on Stackoverflow where the exact question is asked.

https://stackoverflow.com/questions/16325057/why-does-rsa-encrypted-text-give-me-different-results-for-the-same-text

Here is another discussion

https://crypto.stackexchange.com/questions/26249/why-are-rsa-ciphertexts-different-for-the-same-plaintext

In general, it's best to ask technical questions like this in communities filled with people qualified to answer it.
newbie
Activity: 14
Merit: 24
August 10, 2020, 02:25:20 PM
#6
If this key is reused, is even possible to find your private key(and this already happened in the past).
This is usually the case, for example, when considering signing transactions or signing messages and reusing the k value. In such cases of re-used and non-random k values, it is possible to derive the associated private key, as you say.

This is not the case here, however. Encrypting a message in this way only requires knowledge of the public key, not the private key. Otherwise, how would you encrypt a message to send to someone else? There is no way to derive the private key from this encryption process, even with reuse of the ephemeral key.

Yes, you are right. Sorry!  Grin
Re-using ephemeral keys are a problem only wen signing, not encrypting. Maybe they take it as a good practice?
legendary
Activity: 2268
Merit: 18775
August 10, 2020, 05:22:45 AM
#5
If this key is reused, is even possible to find your private key(and this already happened in the past).
This is usually the case, for example, when considering signing transactions or signing messages and reusing the k value. In such cases of re-used and non-random k values, it is possible to derive the associated private key, as you say.

This is not the case here, however. Encrypting a message in this way only requires knowledge of the public key, not the private key. Otherwise, how would you encrypt a message to send to someone else? There is no way to derive the private key from this encryption process, even with reuse of the ephemeral key.
legendary
Activity: 3472
Merit: 10611
August 09, 2020, 08:31:59 PM
#4
it is probably because this option is not used that much and the developers never made it deterministic like all the rest of the elliptic curve cryptography that takes place in your wallet (signing transactions and signing a message). otherwise i can't think of any other reason why this is not deterministic.
you can find it here: https://github.com/spesmilo/electrum/blob/9c5e49f432a4310aa4aec2f7985b52f032210b7e/electrum/ecc.py#L316-L331
by the way ephemeral simply means temporary, it is not the name of the key!
newbie
Activity: 14
Merit: 24
August 09, 2020, 07:09:29 PM
#3
As @AdolfinWolf said, when you encrypt any data with the Elliptic Curve Cripto Family, you create a random key called ephemeral key, and this key is used in the calculations AND ONLY ONCE, it is a disposable one. If this key is reused, is even possible to find your private key(and this already happened in the past). 
legendary
Activity: 1946
Merit: 1427
August 09, 2020, 08:40:31 AM
#2
I believe it's because it takes a random number r (ephemeral private key), which is converted into S(ymmetric key) = rQ (where Q is the public key)

So every time you encrypt a message M, the value r is different, resulting in a different encryption key, resulting in a different encrypted value.
legendary
Activity: 1512
Merit: 7340
Farewell, Leo
August 09, 2020, 07:59:00 AM
#1
When I encrypt a message it gives me an output. When I do it again it gives me a different output, why that?

Jump to: