Bitcoin Forum
April 28, 2024, 05:20:05 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Question about encrypting a message  (Read 256 times)
BlackHatCoiner (OP)
Legendary
*
Offline Offline

Activity: 1498
Merit: 7294


Farewell, Leo


View Profile
August 09, 2020, 12:59:00 PM
Merited by suchmoon (7), OgNasty (1), HCP (1), Heisenberg_Hunter (1)
 #1

When I encrypt a message it gives me an output. When I do it again it gives me a different output, why that?


.
.HUGE.
▄██████████▄▄
▄█████████████████▄
▄█████████████████████▄
▄███████████████████████▄
▄█████████████████████████▄
███████▌██▌▐██▐██▐████▄███
████▐██▐████▌██▌██▌██▌██
█████▀███▀███▀▐██▐██▐█████

▀█████████████████████████▀

▀███████████████████████▀

▀█████████████████████▀

▀█████████████████▀

▀██████████▀▀
█▀▀▀▀











█▄▄▄▄
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
.
CASINSPORTSBOOK
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
▀▀▀▀█











▄▄▄▄█
1714281605
Hero Member
*
Offline Offline

Posts: 1714281605

View Profile Personal Message (Offline)

Ignore
1714281605
Reply with quote  #2

1714281605
Report to moderator
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
1714281605
Hero Member
*
Offline Offline

Posts: 1714281605

View Profile Personal Message (Offline)

Ignore
1714281605
Reply with quote  #2

1714281605
Report to moderator
1714281605
Hero Member
*
Offline Offline

Posts: 1714281605

View Profile Personal Message (Offline)

Ignore
1714281605
Reply with quote  #2

1714281605
Report to moderator
AdolfinWolf
Legendary
*
Offline Offline

Activity: 1946
Merit: 1427


View Profile
August 09, 2020, 01:40:31 PM
Merited by OgNasty (1), ABCbits (1), nc50lc (1), Heisenberg_Hunter (1)
 #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.

JuleAdka
Newbie
*
Offline Offline

Activity: 14
Merit: 24


View Profile
August 10, 2020, 12:09:29 AM
Merited by LoyceV (6), OgNasty (1), ABCbits (1), Husna QA (1)
 #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). 
pooya87
Legendary
*
Offline Offline

Activity: 3430
Merit: 10505



View Profile
August 10, 2020, 01:31:59 AM
Merited by ABCbits (1), Heisenberg_Hunter (1)
 #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!

.
.BLACKJACK ♠ FUN.
█████████
██████████████
████████████
█████████████████
████████████████▄▄
░█████████████▀░▀▀
██████████████████
░██████████████
████████████████
░██████████████
████████████
███████████████░██
██████████
CRYPTO CASINO &
SPORTS BETTING
▄▄███████▄▄
▄███████████████▄
███████████████████
█████████████████████
███████████████████████
█████████████████████████
█████████████████████████
█████████████████████████
███████████████████████
█████████████████████
███████████████████
▀███████████████▀
█████████
.
o_e_l_e_o
In memoriam
Legendary
*
Offline Offline

Activity: 2268
Merit: 18507


View Profile
August 10, 2020, 10:22:45 AM
Merited by suchmoon (7), pooya87 (2), ABCbits (1)
 #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.
JuleAdka
Newbie
*
Offline Offline

Activity: 14
Merit: 24


View Profile
August 10, 2020, 07: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?
DarkDays
Legendary
*
Offline Offline

Activity: 2030
Merit: 1189


View Profile
August 13, 2020, 05: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.
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!