Bitcoin Forum
May 22, 2024, 08:52:34 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Master public key in another format? Desperate for help for an easy question!  (Read 581 times)
lophie (OP)
Hero Member
*****
Offline Offline

Activity: 924
Merit: 1001

Unlimited Free Crypto


View Profile
June 02, 2014, 06:37:27 PM
 #1

Hello all,

I will make it short not to waste your time.

 
Quote
5b8d161b69c4d417b1a3b83ad6a6d06653aefb7bfe1a88e0ae94f86b1709fe24650e6eb57b51204 658883af420c4ca146b958768f0724a4449a24f6a2397b1de

This string is a Master Public Key. But it is not related to my small question the nature of this string. What I know about it is that it is in Hex format

Now look at this array of integers

Quote
91,141,22,27,105,196,212,23,177,163,184,58,214,166,208,102,83,174,251,123,254,26,136,224,174,148,248,107,23,9,254,36,101,14,110,181,123,81,32,70,88,136,58,244,32,196,202,20,107,149,135,104,240,114,74,68,73,162,79,106,35,151,177,222


They are supposed to mean the same thing. The second array of integers is supposed to reflect either all or most of the Master Public Key above it. Can someone PLEASE help me understand what is the connection between them? In what format the integer array is and how to convert either from the first to the second or vice versa.

Thank you for reading and thank you for any help. I really appreciate it.

- Lophie

Will take me a while to climb up again, But where is a will, there is a way...
DeathAndTaxes
Donator
Legendary
*
Offline Offline

Activity: 1218
Merit: 1079


Gerald Davis


View Profile
June 02, 2014, 06:44:02 PM
 #2

They are the same exact value.

The sequence of integers each represent one byte (0-255) or 8 bits.  A Hex value is 4 bits.  So it takes two hex digits to represent one byte.

0x5b = 91
0x8d = 141
...
0xde = 222
lophie (OP)
Hero Member
*****
Offline Offline

Activity: 924
Merit: 1001

Unlimited Free Crypto


View Profile
June 02, 2014, 06:46:12 PM
 #3

They are the same exact value.

The sequence of integers each represent one byte (0-255) or 8 bits.  A Hex value is 4 bits.  So it takes two hex digits to represent one byte.

0x5b = 91
0x8d = 141
...
0xde = 222

THANK YOU! I expected the same but for the love of god I don't know how to convert the first to the second! I am trying to do this in java script. Can you please give me some pointers? Do you know what data type is the second? how can I convert a "string" with the first to the second in javascript?

Will take me a while to climb up again, But where is a will, there is a way...
DeathAndTaxes
Donator
Legendary
*
Offline Offline

Activity: 1218
Merit: 1079


Gerald Davis


View Profile
June 02, 2014, 06:58:55 PM
 #4

The first is a hex string, the second is a byte array.  Conversion between the two is a pretty standard programing task.  I would google "javascript convert hex to byte array".
lophie (OP)
Hero Member
*****
Offline Offline

Activity: 924
Merit: 1001

Unlimited Free Crypto


View Profile
June 02, 2014, 07:01:44 PM
 #5

The first is a hex string, the second is a byte array.  Conversion between the two is pretty standard.  I would google "javascript conver hex to byte array".

HOOORAY I have done it finally!!!

function parseHexString(str) {
    var result = [];
    while (str.length >= 2) {
        result.push(parseInt(str.substring(0, 2), 16));
        str = str.substring(2, str.length);
    }

    return result;
}

Thanks. Thank you so very much!.

mmm should I close the thread or just delete it? It is not very informative to this community is it?

Will take me a while to climb up again, But where is a will, there is a way...
shorena
Copper Member
Legendary
*
Offline Offline

Activity: 1498
Merit: 1520


No I dont escrow anymore.


View Profile WWW
June 02, 2014, 07:08:01 PM
 #6

The first is a hex string, the second is a byte array.  Conversion between the two is pretty standard.  I would google "javascript conver hex to byte array".

HOOORAY I have done it finally!!!
Code:
function parseHexString(str) { 
    var result = [];
    while (str.length >= 2) {
        result.push(parseInt(str.substring(0, 2), 16));
        str = str.substring(2, str.length);
    }

    return result;
}

Thanks. Thank you so very much!.

mmm should I close the thread or just delete it? It is not very informative to this community is it?


You will never know if someone might have the exact same question. Just close it, I also made your code look nice with code tags Wink

Im not really here, its just your imagination.
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!