Bitcoin Forum
May 13, 2024, 07:18:03 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Format of the keys  (Read 182 times)
bkelly13 (OP)
Member
**
Offline Offline

Activity: 63
Merit: 33


View Profile
December 06, 2022, 03:32:12 AM
Merited by ABCbits (1)
 #1

As I read about Bitcoin and the keys used, a thought occurs to me.
When the value of an example key is shown, it usually takes one of three forms:
Hex looks like:  50863ad64a8  …
Base58 looks like:  1AQXmgRZTXr …
And on occasion binary looks like: 01010000100 …
But these are all representations so we can view them.  Computers deal with binary but we cannot display the binary directly, just the ASCII representation of the number.  When our wallets begin with a private key, do they translate to binary or do they start by hashing the hex or Base58 ASCII representation of the number?
1715584683
Hero Member
*
Offline Offline

Posts: 1715584683

View Profile Personal Message (Offline)

Ignore
1715584683
Reply with quote  #2

1715584683
Report to moderator
1715584683
Hero Member
*
Offline Offline

Posts: 1715584683

View Profile Personal Message (Offline)

Ignore
1715584683
Reply with quote  #2

1715584683
Report to moderator
1715584683
Hero Member
*
Offline Offline

Posts: 1715584683

View Profile Personal Message (Offline)

Ignore
1715584683
Reply with quote  #2

1715584683
Report to moderator
"There should not be any signed int. If you've found a signed int somewhere, please tell me (within the next 25 years please) and I'll change it to unsigned int." -- Satoshi
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
1715584683
Hero Member
*
Offline Offline

Posts: 1715584683

View Profile Personal Message (Offline)

Ignore
1715584683
Reply with quote  #2

1715584683
Report to moderator
pooya87
Legendary
*
Offline Offline

Activity: 3444
Merit: 10558



View Profile
December 06, 2022, 03:52:23 AM
Merited by ABCbits (2), hosseinimr93 (2)
 #2

When our wallets begin with a private key, do they translate to binary or do they start by hashing the hex or Base58 ASCII representation of the number?
It depends on what they want to do with it.
If the key is generated to be stored in the wallet file, some wallets convert it to base58 (called WIF) and store it in the file. The SHA256 hash is only for computation of the checksum.
If the wallet is supposed to use it to sign a transaction or compute the public key and the address, they'll have to convert it to a 256-bit integer which in most cases an array of unsigned 32-bit integers that would stored the bits for subsequent arithmetics. There is no hashing involved in ECC and only for checksum in base58 address in last step.

.
.BLACKJACK ♠ FUN.
█████████
██████████████
████████████
█████████████████
████████████████▄▄
░█████████████▀░▀▀
██████████████████
░██████████████
████████████████
░██████████████
████████████
███████████████░██
██████████
CRYPTO CASINO &
SPORTS BETTING
▄▄███████▄▄
▄███████████████▄
███████████████████
█████████████████████
███████████████████████
█████████████████████████
█████████████████████████
█████████████████████████
███████████████████████
█████████████████████
███████████████████
▀███████████████▀
█████████
.
bkelly13 (OP)
Member
**
Offline Offline

Activity: 63
Merit: 33


View Profile
December 06, 2022, 04:07:39 AM
Last edit: December 06, 2022, 04:50:43 AM by bkelly13
 #3

I have read that the SHA-256 and the RIPEMD-160 are both used to produce the public key, then the address.  Am I wrong about that?
And from the reply I presume that the hex or base58 version is converted to binary before the conversion?

Edit
I just looked at the only SHA-256 code I could find and its input is std:string
Maybe this is not what I am looking for.
Do all the engineers that make wallets use math guys with Master's degrees?  Or can they find example code and detailed procedures that I cannot find?
nc50lc
Legendary
*
Online Online

Activity: 2408
Merit: 5600


Self-proclaimed Genius


View Profile
December 06, 2022, 05:24:34 AM
Merited by pooya87 (2), ABCbits (2), hosseinimr93 (2)
 #4

I have read that the SHA-256 and the RIPEMD-160 are both used to produce the public key, then the address.  Am I wrong about that?
Quite, those are used when deriving the address from the public key, but not the public key itself.
The public key is computed from the private key through "EC point multiplication" along "secp256k1" curve.

Some resources that cover that topic:

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

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

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

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

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

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











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











▄▄▄▄█
witcher_sense
Legendary
*
Offline Offline

Activity: 2338
Merit: 4336

🔐BitcoinMessage.Tools🔑


View Profile WWW
December 06, 2022, 06:37:28 AM
 #5

Do all the engineers that make wallets use math guys with Master's degrees?  Or can they find example code and detailed procedures that I cannot find?
There is no point in re-inventing the wheel unless doing that for fun or learning purposes. Engineers are people who transform improvised materials into functional products, but that doesn't mean those materials themselves can't be functional products. If you're building a simple application such as a bitcoin wallet and looking for certain functionality such as private key-public key conversion, you simply import a certain third-party library that provides this functionality. This library will have all the functions required for the calculation of a public key, and you don't even need to know how it works (of course if we assume that the code is not malicious and well-reviewed) because you're only interested in the fact that the result returned by a function is correct.

█▀▀▀











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











▄▄▄█
▄██████▄▄▄
█████████████▄▄
███████████████
███████████████
███████████████
███████████████
███░░█████████
███▌▐█████████
█████████████
███████████▀
██████████▀
████████▀
▀██▀▀
fennic
Member
**
Offline Offline

Activity: 126
Merit: 39


View Profile
December 06, 2022, 07:04:53 PM
 #6

In my point of view, Bitcoin private key that is represented in many ways. These private keys 🗝️ are mostly in Hexadecimal numbers or they can be in 64 numbers long.
This key can be in 0-9 or A-F characters long.
Here is an example,
E9873D79C6D87DC0FB6A5778633389_SAMPLE_PRIVATE_KEY_DO_NOT_IMPORT_F4453213303DA61 F20BD67FC233AA33262
For more information: https://en.bitcoin.it/wiki/Private_key#:~:text=In%20Bitcoin%2C%20a%20private%20key,range%200%2D9%20or%20A%2DF.

▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬ Bet2Dream ▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬
▬▬▬▬▬  Get Free Bal($) When You Register! Join Now!  ▬▬▬▬▬
▬▬▬  Referral & Mining Program | Event & Daily Rewards! | Bet2Dream NFT Club! ▬▬▬
pooya87
Legendary
*
Offline Offline

Activity: 3444
Merit: 10558



View Profile
December 07, 2022, 04:19:16 AM
 #7

In my point of view, Bitcoin private key that is represented in many ways. These private keys 🗝️ are mostly in Hexadecimal numbers or they can be in 64 numbers long.
This key can be in 0-9 or A-F characters long.
Actually every wallet or key took I've seen uses WIFs which is base58 encoding and they may show the hexadecimal format on top of that but not as the main encoding.

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

Activity: 4312
Merit: 3214



View Profile
December 07, 2022, 10:29:17 AM
 #8

Actually every wallet or key took I've seen uses WIFs which is base58 encoding and they may show the hexadecimal format on top of that but not as the main encoding.

In the Bitcoin world, the private keys we see are usually encoded with Base58Check, but in other applications they are typically encoded as base-64 after being encrypted.

Join an anti-signature campaign: Click ignore on the members of signature campaigns.
PGP Fingerprint: 6B6BC26599EC24EF7E29A405EAF050539D0B2925 Signing address: 13GAVJo8YaAuenj6keiEykwxWUZ7jMoSLt
pooya87
Legendary
*
Offline Offline

Activity: 3444
Merit: 10558



View Profile
December 08, 2022, 04:01:41 AM
 #9

Actually every wallet or key took I've seen uses WIFs which is base58 encoding and they may show the hexadecimal format on top of that but not as the main encoding.

In the Bitcoin world, the private keys we see are usually encoded with Base58Check, but in other applications they are typically encoded as base-64 after being encrypted.
That's right, the storage encoding is usually different from the encoding used for representing the keys. But that too depends on the software. For example sometimes they just store the key (encrypted or unecrypted) as binary in a .dat file so there is no string encoding used there, or in case of Electrum if the key is not encrypted they would be stored in Base58 form.

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

Activity: 3388
Merit: 4653



View Profile
December 09, 2022, 12:02:55 AM
 #10

As many have been suggesting, storage format and display format are entirely up to the designer of the software (wallet, exchange, casino, whatever).  It can be Hex, Base58, Binary, Octal, or something else entirely.  Doesn't really matter.

When its time to actually USE those values though (such as generating a public key or signature via ECDSA), then it will be used in its binary representation of the value itself (NOT the binary representation of whatever ascii characters were used to display it to a user)
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!