Bitcoin Forum
May 26, 2024, 12:40:13 PM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: [Solved] I get weird results when I try to count the bits of a public key  (Read 152 times)
BlackHatCoiner (OP)
Legendary
*
Online Online

Activity: 1526
Merit: 7433


Farewell, Leo


View Profile
December 02, 2020, 09:11:20 AM
Last edit: December 02, 2020, 01:58:36 PM by BlackHatCoiner
 #1

This public key: 0361b5051847a4c00b8fdfe43f9e508099d8375bc84a892e6989733d39bf67c3cc is 66 characters long and it's 258 bits (without the checksum). If I remove the first character, nothing will change to the bits and that's obvious, zero doesn't count. If I remove the second character, though, I get 255 bits.

61b5051847a4c00b8fdfe43f9e508099d8375bc84a892e6989733d39bf67c3cc: 255 bits.

Although, this public key: 03d0f099265fe878d4c93315605ab2f3628be79282187e652e3656a472c27388db which is also 258 bits without the checksum returns me 256 bits when I remove the second character:
d0f099265fe878d4c93315605ab2f3628be79282187e652e3656a472c27388db: 256 bits.

Generating public keys that are 255 bits without the number sign (02 or 03) prevents me from generating mnemonics with them. (Hex to Mnemonic)

Why does this happen? Isn't suppose to be 254 bits without the sign?

I have another example.
Public key: 030244f088c1903ef7ac38f1f35ef8ae6b31fd8c5d4b77185ba6b1c037bdccb3a5 is 258 bits.

0244f088c1903ef7ac38f1f35ef8ae6b31fd8c5d4b77185ba6b1c037bdccb3a5 is 250 bits.

.
.BLACKJACK ♠ FUN.
█████████
██████████████
████████████
█████████████████
████████████████▄▄
░█████████████▀░▀▀
██████████████████
░██████████████
████████████████
░██████████████
████████████
███████████████░██
██████████
CRYPTO CASINO &
SPORTS BETTING
▄▄███████▄▄
▄███████████████▄
███████████████████
█████████████████████
███████████████████████
█████████████████████████
█████████████████████████
█████████████████████████
███████████████████████
█████████████████████
███████████████████
▀███████████████▀
█████████
.
BlackHatCoiner (OP)
Legendary
*
Online Online

Activity: 1526
Merit: 7433


Farewell, Leo


View Profile
December 02, 2020, 01:58:27 PM
 #2

I would like to update that I found out what's going on. My conversion from hexadecimal to binary was... throwing away the starting binary zeros (if it had any). This is why I was getting weird results. Because it's random and I didn't know how many zeros one public key may have if we remove the first sign of it. I solved my issue by just converting hex to bin with C#. I used rapidtables.com, but it seems that they remove the starting zeros of a hex by default.

Problem solved!

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

Activity: 4326
Merit: 3239



View Profile
December 03, 2020, 10:29:31 PM
 #3

I would like to update that I found out what's going on. My conversion from hexadecimal to binary was... throwing away the starting binary zeros (if it had any). This is why I was getting weird results. Because it's random and I didn't know how many zeros one public key may have if we remove the first sign of it. I solved my issue by just converting hex to bin with C#. I used rapidtables.com, but it seems that they remove the starting zeros of a hex by default.

Problem solved!

I don't know what you are trying to do, but a hexadecimal number has exactly 4 bits per digit.

Join an anti-signature campaign: Click ignore on the members of signature campaigns.
PGP Fingerprint: 6B6BC26599EC24EF7E29A405EAF050539D0B2925 Signing address: 13GAVJo8YaAuenj6keiEykwxWUZ7jMoSLt
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!