Bitcoin Forum
April 24, 2024, 11:55:49 PM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: how to reverse convert || Public-key example : 0x1234 >> 0x4321  (Read 184 times)
mausuv (OP)
Jr. Member
*
Offline Offline

Activity: 70
Merit: 1


View Profile
April 19, 2022, 02:28:37 PM
 #1

hi,i speak little eng

priv : 0x1234 orginal
pub : px: 37a4aef1f8423ca076e4b7d99a8cabff40ddb8231f2a9f01081f15d7fa65c1ba   py: b96ced90a1b8f9b43a18fc900ff55af2be0e94b90a434fca5b9e226b835024cd

priv :0x4321 reverse
pub : px: ca724c17f382810d9768be999797e4f1c0c8301c3242dde18c1704bab0acd5b   py: fc88f4627d17e9a456271c937263abfbb592cdecf172e31979fe6a73b4ebc589

example:
Code:
orginal pub                         >>   reverse pub need
-----------------------------------------------------------------------------------------------------
0x1234                              >>   0x4321
0xb862a62e                          >>   0xe26a268b
0x60f4d11574f5deee49961d9609ac7     >>   0x7ca9069d16994eeed5f47511d4f06
0xabcdef                            >>   0xfedcba

how to reverse convert for Public-key please explain.
i need Public-key reverse convert, please understand my problem.  Huh
make python code please ...

solve today please, i need it
use this git: https://github.com/ragestack/EC-Point-Operations
BitcoinCleanup.com: Learn why Bitcoin isn't bad for the environment
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
1714002949
Hero Member
*
Offline Offline

Posts: 1714002949

View Profile Personal Message (Offline)

Ignore
1714002949
Reply with quote  #2

1714002949
Report to moderator
1714002949
Hero Member
*
Offline Offline

Posts: 1714002949

View Profile Personal Message (Offline)

Ignore
1714002949
Reply with quote  #2

1714002949
Report to moderator
1714002949
Hero Member
*
Offline Offline

Posts: 1714002949

View Profile Personal Message (Offline)

Ignore
1714002949
Reply with quote  #2

1714002949
Report to moderator
n0nce
Hero Member
*****
Offline Offline

Activity: 882
Merit: 5814


not your keys, not your coins!


View Profile WWW
April 19, 2022, 02:57:31 PM
Merited by pooya87 (2), ABCbits (1)
 #2

Here you go:
Code:
a = '0xb862a62e'
print(f'0x{a[2:][::-1]}')

If you have many of these:
Code:
keys=['0x1234', '0xb862a62e', '0x60f4d11574f5deee49961d9609ac7', '0xabcdef']
for key in keys:
  print(f'{key} >> 0x{key[2:][::-1]}')

█▀▀▀











█▄▄▄
▀▀▀▀▀▀▀▀▀▀▀
e
▄▄▄▄▄▄▄▄▄▄▄
█████████████
████████████▄███
██▐███████▄█████▀
█████████▄████▀
███▐████▄███▀
████▐██████▀
█████▀█████
███████████▄
████████████▄
██▄█████▀█████▄
▄█████████▀█████▀
███████████▀██▀
████▀█████████
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
c.h.
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
▀▀▀█











▄▄▄█
▄██████▄▄▄
█████████████▄▄
███████████████
███████████████
███████████████
███████████████
███░░█████████
███▌▐█████████
█████████████
███████████▀
██████████▀
████████▀
▀██▀▀
mausuv (OP)
Jr. Member
*
Offline Offline

Activity: 70
Merit: 1


View Profile
April 19, 2022, 03:18:21 PM
 #3

Here you go:
Code:
a = '0xb862a62e'
print(f'0x{a[2:][::-1]}')

If you have many of these:
Code:
keys=['0x1234', '0xb862a62e', '0x60f4d11574f5deee49961d9609ac7', '0xabcdef']
for key in keys:
  print(f'{key} >> 0x{key[2:][::-1]}')


i know this bro,
i need publickey reverse see this pub

priv : 0x1234 orginal
pub : px: 37a4aef1f8423ca076e4b7d99a8cabff40ddb8231f2a9f01081f15d7fa65c1ba   py: b96ced90a1b8f9b43a18fc900ff55af2be0e94b90a434fca5b9e226b835024cd orginal

priv :0x4321 reverse
pub : px: ca724c17f382810d9768be999797e4f1c0c8301c3242dde18c1704bab0acd5b   py: fc88f4627d17e9a456271c937263abfbb592cdecf172e31979fe6a73b4ebc589 reverse
_Counselor
Member
**
Offline Offline

Activity: 107
Merit: 61


View Profile
April 19, 2022, 03:21:07 PM
 #4

This cannot be done without knowing the private key.
pooya87
Legendary
*
Offline Offline

Activity: 3430
Merit: 10498



View Profile
April 19, 2022, 03:27:12 PM
Merited by ABCbits (1), n0nce (1)
 #5

Reversing the bytes order or whatever type of swapping bits is not going to create a relationship between your two public keys, you still have to multiply the resulting integer by the generator point to compute the corresponding public keys.

.
.BLACKJACK ♠ FUN.
█████████
██████████████
████████████
█████████████████
████████████████▄▄
░█████████████▀░▀▀
██████████████████
░██████████████
████████████████
░██████████████
████████████
███████████████░██
██████████
CRYPTO CASINO &
SPORTS BETTING
▄▄███████▄▄
▄███████████████▄
███████████████████
█████████████████████
███████████████████████
█████████████████████████
█████████████████████████
█████████████████████████
███████████████████████
█████████████████████
███████████████████
▀███████████████▀
█████████
.
n0nce
Hero Member
*****
Offline Offline

Activity: 882
Merit: 5814


not your keys, not your coins!


View Profile WWW
April 19, 2022, 03:29:57 PM
 #6

i know this bro,
i need publickey reverse see this pub
That would require breaking public key crypto. Cheesy I gave you what you wanted (reversing the whole hex representation) but you can't go from a public key to a private key; otherwise all the pk cryptography would be broken.

█▀▀▀











█▄▄▄
▀▀▀▀▀▀▀▀▀▀▀
e
▄▄▄▄▄▄▄▄▄▄▄
█████████████
████████████▄███
██▐███████▄█████▀
█████████▄████▀
███▐████▄███▀
████▐██████▀
█████▀█████
███████████▄
████████████▄
██▄█████▀█████▄
▄█████████▀█████▀
███████████▀██▀
████▀█████████
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
c.h.
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
▀▀▀█











▄▄▄█
▄██████▄▄▄
█████████████▄▄
███████████████
███████████████
███████████████
███████████████
███░░█████████
███▌▐█████████
█████████████
███████████▀
██████████▀
████████▀
▀██▀▀
PawGo
Legendary
*
Offline Offline

Activity: 952
Merit: 1367


View Profile
April 19, 2022, 05:09:26 PM
 #7

Here you are, a small program in java, uses bitcoinj library. I had 4 minutes to kill, so why not.
BTW there are dozens of way how to reverse string, it is probably one of the most popular tasks for the 1st programming lesson Wink


Code:
import org.bitcoinj.core.ECKey;
import java.math.BigInteger;

public class Reverse {

    public static void main(String args[]){
        //String originalKey = args[0];
        String originalKey = "1234";
        BigInteger originalBI = new BigInteger(originalKey, 16);
        ECKey ecKey = ECKey.fromPrivate(originalBI);
        System.out.println(originalBI.toString(16)+" -> "+ecKey.getPubKeyPoint().getXCoord().toString()+" "+ecKey.getPubKeyPoint().getYCoord().toString());
        StringBuilder sb = new StringBuilder(originalKey);
        sb.reverse();
        BigInteger reversedBI = new BigInteger(sb.toString(), 16);
        ecKey = ECKey.fromPrivate(reversedBI);
        System.out.println(reversedBI.toString(16)+" -> "+ecKey.getPubKeyPoint().getXCoord().toString()+" "+ecKey.getPubKeyPoint().getYCoord().toString());
    }
}

Produced output:
Code:
1234 -> 37a4aef1f8423ca076e4b7d99a8cabff40ddb8231f2a9f01081f15d7fa65c1ba b96ced90a1b8f9b43a18fc900ff55af2be0e94b90a434fca5b9e226b835024cd
4321 -> ca724c17f382810d9768be999797e4f1c0c8301c3242dde18c1704bab0acd5b fc88f4627d17e9a456271c937263abfbb592cdecf172e31979fe6a73b4ebc589
mausuv (OP)
Jr. Member
*
Offline Offline

Activity: 70
Merit: 1


View Profile
April 19, 2022, 06:01:42 PM
 #8

Here you are, a small program in java, uses bitcoinj library. I had 4 minutes to kill, so why not.
BTW there are dozens of way how to reverse string, it is probably one of the most popular tasks for the 1st programming lesson Wink


Code:
import org.bitcoinj.core.ECKey;
import java.math.BigInteger;

public class Reverse {

    public static void main(String args[]){
        //String originalKey = args[0];
        String originalKey = "1234";
        BigInteger originalBI = new BigInteger(originalKey, 16);
        ECKey ecKey = ECKey.fromPrivate(originalBI);
        System.out.println(originalBI.toString(16)+" -> "+ecKey.getPubKeyPoint().getXCoord().toString()+" "+ecKey.getPubKeyPoint().getYCoord().toString());
        StringBuilder sb = new StringBuilder(originalKey);
        sb.reverse();
        BigInteger reversedBI = new BigInteger(sb.toString(), 16);
        ecKey = ECKey.fromPrivate(reversedBI);
        System.out.println(reversedBI.toString(16)+" -> "+ecKey.getPubKeyPoint().getXCoord().toString()+" "+ecKey.getPubKeyPoint().getYCoord().toString());
    }
}

Produced output:
Code:
1234 -> 37a4aef1f8423ca076e4b7d99a8cabff40ddb8231f2a9f01081f15d7fa65c1ba b96ced90a1b8f9b43a18fc900ff55af2be0e94b90a434fca5b9e226b835024cd
4321 -> ca724c17f382810d9768be999797e4f1c0c8301c3242dde18c1704bab0acd5b fc88f4627d17e9a456271c937263abfbb592cdecf172e31979fe6a73b4ebc589

my question
you code working for all my example tell me

example:
Code:
orginal pub                         >>   reverse pub need
-----------------------------------------------------------------------------------------------------
0x1234                              >>   0x4321
0xb862a62e                          >>   0xe26a268b
0x60f4d11574f5deee49961d9609ac7     >>   0x7ca9069d16994eeed5f47511d4f06
0xabcdef                            >>   0xfedcba

how to run it java,i dont know java
please make python Huh, i only know python ,anyone make this java to python
PawGo
Legendary
*
Offline Offline

Activity: 952
Merit: 1367


View Profile
April 19, 2022, 06:09:37 PM
 #9


my question
you code working for all my example tell me

example:
Code:
orginal pub                         >>   reverse pub need
-----------------------------------------------------------------------------------------------------
0x1234                              >>   0x4321
0xb862a62e                          >>   0xe26a268b
0x60f4d11574f5deee49961d9609ac7     >>   0x7ca9069d16994eeed5f47511d4f06
0xabcdef                            >>   0xfedcba

Of course, why not?

Code:
b862a62e -> 9c58240e50e3ba3f833c82655e8725c037a2294e14cf5d73a5df8d56159de69 4fd08050375c910eecb46adeb9ffde4614adbf875f0493ad8d0a117d23b219e0
e26a268b -> d4ad36935c5643a693a070094888d3f2feefeec42e22b6861fbca5055b957d0 d227416ab812cb07315855089a925c4ae930fabda57c3fc314822052016756ec

60f4d11574f5deee49961d9609ac7 -> 13eb25c8341802b0576cd0cbe003f7e9a57b0fcd8eb80dc2e51aeecc8e6bee1b 93c63a32550732dafb9f94ac269c9c3ef8ee81cf323490d44d6dee102d11b570
7ca9069d16994eeed5f47511d4f06 -> f52fff931d084d0ff39eff4ee1b2c3483e1fe10a4325464b24cb19e69bdff795 4b98d811c13438e50918d0e4a83586bb66f186f522043e84734d570b38913123

abcdef -> 12faae608bd6562562b8f85564664cd1fdcd667f6b24b2b221ef86b9231f4d74 512ee8cd9b34331afd05ccb8d81d1393c150c73ec5695845b731f7e6e0086719
fedcba -> e818438fed36042be128d6527671d69415c842cd7072b6d4abe13f2804f17ce2 8e181d2817d7c076125fefff32b6119bf9d68b59f2b956ec6d27c6e4bf098625


mausuv (OP)
Jr. Member
*
Offline Offline

Activity: 70
Merit: 1


View Profile
April 19, 2022, 06:20:16 PM
 #10


Of course, why not?

Code:
b862a62e -> 9c58240e50e3ba3f833c82655e8725c037a2294e14cf5d73a5df8d56159de69 4fd08050375c910eecb46adeb9ffde4614adbf875f0493ad8d0a117d23b219e0
e26a268b -> d4ad36935c5643a693a070094888d3f2feefeec42e22b6861fbca5055b957d0 d227416ab812cb07315855089a925c4ae930fabda57c3fc314822052016756ec

60f4d11574f5deee49961d9609ac7 -> 13eb25c8341802b0576cd0cbe003f7e9a57b0fcd8eb80dc2e51aeecc8e6bee1b 93c63a32550732dafb9f94ac269c9c3ef8ee81cf323490d44d6dee102d11b570
7ca9069d16994eeed5f47511d4f06 -> f52fff931d084d0ff39eff4ee1b2c3483e1fe10a4325464b24cb19e69bdff795 4b98d811c13438e50918d0e4a83586bb66f186f522043e84734d570b38913123

abcdef -> 12faae608bd6562562b8f85564664cd1fdcd667f6b24b2b221ef86b9231f4d74 512ee8cd9b34331afd05ccb8d81d1393c150c73ec5695845b731f7e6e0086719
fedcba -> e818438fed36042be128d6527671d69415c842cd7072b6d4abe13f2804f17ce2 8e181d2817d7c076125fefff32b6119bf9d68b59f2b956ec6d27c6e4bf098625
sorry again one more question

i am not understand for java ,i can't read you code
so, question is your code working for without private key tell me

example like this:
enter this publickey         : 37a4aef1f8423ca076e4b7d99a8cabff40ddb8231f2a9f01081f15d7fa65c1ba b96ced90a1b8f9b43a18fc900ff55af2be0e94b90a434fca5b9e226b835024cd
output is reverse publickey : ca724c17f382810d9768be999797e4f1c0c8301c3242dde18c1704bab0acd5b fc88f4627d17e9a456271c937263abfbb592cdecf172e31979fe6a73b4ebc589
PawGo
Legendary
*
Offline Offline

Activity: 952
Merit: 1367


View Profile
April 19, 2022, 06:39:17 PM
Merited by ABCbits (1), n0nce (1)
 #11

so, question is your code working for without private key tell me

No, it is not possible, like others said before.
I have one more remark: you take two random private keys, do a weird operation (“reverse”), calculate public keys from both and you expect to have correlation. It is a mistake from the beginning. You use hexadecimal representation, so you expect that key “abc” has something in common with key “cba”. The same key “12” in hex would be somehow correlated to key “21”. But on other hand, hex 12 is 18 in decimal system, which, if you reverse characters is 81, which is “51” in hex Smiley do you see it makes no sense at all? If you represent private key in binary format, you will receive again completely different results.


ymgve2
Full Member
***
Offline Offline

Activity: 161
Merit: 230


View Profile
April 24, 2022, 05:48:11 PM
Merited by o_e_l_e_o (4), ABCbits (2)
 #12

so, question is your code working for without private key tell me

No, it is not possible, like others said before.
I have one more remark: you take two random private keys, do a weird operation (“reverse”), calculate public keys from both and you expect to have correlation. It is a mistake from the beginning. You use hexadecimal representation, so you expect that key “abc” has something in common with key “cba”. The same key “12” in hex would be somehow correlated to key “21”. But on other hand, hex 12 is 18 in decimal system, which, if you reverse characters is 81, which is “51” in hex Smiley do you see it makes no sense at all? If you represent private key in binary format, you will receive again completely different results.




Also, it's not even a proper "reverse" in hex form. A proper "reverse" of 0x1234 would be 0x4321000000000000000000000000000000000000000000000000000000000000.

(And this still gives no relationship between public keys, of course)
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!