Author

Topic: how to reverse convert || Public-key example : 0x1234 >> 0x4321 (Read 208 times)

full member
Activity: 161
Merit: 230
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)
legendary
Activity: 952
Merit: 1385
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.


jr. member
Activity: 70
Merit: 1

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
legendary
Activity: 952
Merit: 1385

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


jr. member
Activity: 70
Merit: 1
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
legendary
Activity: 952
Merit: 1385
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
hero member
Activity: 882
Merit: 5834
not your keys, not your coins!
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.
legendary
Activity: 3472
Merit: 10611
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.
member
Activity: 110
Merit: 61
This cannot be done without knowing the private key.
jr. member
Activity: 70
Merit: 1
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
hero member
Activity: 882
Merit: 5834
not your keys, not your coins!
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]}')
jr. member
Activity: 70
Merit: 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
Jump to: