Bitcoin Forum
May 14, 2024, 06:14:54 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Problem when I try to create an address from zero  (Read 170 times)
BlackHatCoiner (OP)
Legendary
*
Offline Offline

Activity: 1512
Merit: 7366


Farewell, Leo


View Profile
September 28, 2020, 11:36:42 AM
Merited by mocacinno (1)
 #1

https://en.bitcoin.it/wiki/Technical_background_of_version_1_Bitcoin_addresses
^In this link it shows us the procedure to create a bitcoin address (version 1)

I take the public key (0250863ad64a87ae8a2fe83c1af1a8403cb53f53e486d8511dad8a04887e5b2352) and I hash it with SHA256:



Then it says that I have to take the result of SHA256 (0b7c28c9b7290c98d7438e70b3d3f7c848fbd7d1dc194ff83f4f7cc9b1378e98) and perform RIPEMD-160 to it. While the site says that the result should be that:

Code:
f54a5851e9372b87810a8e60cdd2e7cfd80b6e31

I get that:
Code:
6836d8a2986c8c34881114fe0412a1d416ae02a8



What do I do wrong? All the "ripemd160 hash online" sites print me the same result.

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

Posts: 1715667294

View Profile Personal Message (Offline)

Ignore
1715667294
Reply with quote  #2

1715667294
Report to moderator
1715667294
Hero Member
*
Offline Offline

Posts: 1715667294

View Profile Personal Message (Offline)

Ignore
1715667294
Reply with quote  #2

1715667294
Report to moderator
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
1715667294
Hero Member
*
Offline Offline

Posts: 1715667294

View Profile Personal Message (Offline)

Ignore
1715667294
Reply with quote  #2

1715667294
Report to moderator
1715667294
Hero Member
*
Offline Offline

Posts: 1715667294

View Profile Personal Message (Offline)

Ignore
1715667294
Reply with quote  #2

1715667294
Report to moderator
1715667294
Hero Member
*
Offline Offline

Posts: 1715667294

View Profile Personal Message (Offline)

Ignore
1715667294
Reply with quote  #2

1715667294
Report to moderator
PawGo
Legendary
*
Offline Offline

Activity: 952
Merit: 1367


View Profile
September 28, 2020, 12:05:41 PM
 #2

Here it works as expected:
https://learnmeabitcoin.com/technical/public-key-hash
pooya87
Legendary
*
Offline Offline

Activity: 3444
Merit: 10560



View Profile
September 28, 2020, 12:23:56 PM
Merited by o_e_l_e_o (2), mocacinno (1), ABCbits (1), nc50lc (1)
 #3

it is because in your first hash you set the input type correctly but then you moved to another website that didn't have that option so your input type is wrong. more accurately your RIPEMD160 is interpreting the input (0b7c28...) as a UTF8 string not hexadecimal input.

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

Activity: 2268
Merit: 18515


View Profile
September 28, 2020, 12:28:45 PM
Merited by pooya87 (1), mocacinno (1), ABCbits (1)
 #4

Here, use this site instead: https://www.pelock.com/products/hash-calculator

As pooya87 says, the output of the SHA256 needs to be inputted in to the RIPEMD160 function as hexadecimal bytes, and not as a plain text string. If you take the result of your SHA256 hash:
Code:
0B7C28C9B7290C98D7438E70B3D3F7C848FBD7D1DC194FF83F4F7CC9B1378E98
And enter it in to the second box down titled "Hash hex bytes" and then hit calculate, you will get the correct RIPEMD160 result:
Code:
F54A5851E9372B87810A8E60CDD2E7CFD80B6E31
BlackHatCoiner (OP)
Legendary
*
Offline Offline

Activity: 1512
Merit: 7366


Farewell, Leo


View Profile
September 28, 2020, 12:37:58 PM
 #5

Thank you, it works properly.

Are there any libraries that allow me to convert hex to ripemd160 with javascript? I'm trying to build something.

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

Activity: 180
Merit: 38


View Profile
September 28, 2020, 12:59:38 PM
 #6

Here https://github.com/bitaps-com/jsbtc

Test page: https://github.com/bitaps-com/jsbtc/blob/master/test/jsbtc.test.js

Or here https://github.com/bitcoinjs/bitcoinjs-lib

Test page: https://github.com/bitcoinjs/bitcoinjs-lib/blob/master/ts_src/crypto.ts

 Smiley
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!