• About
  • FAQ
  • Earn Bitcoin while Surfing the net
  • Buy & Sell Crypto on Paxful
Newsletter
Approx Foundation
  • Home
    • Home – Layout 1
  • Bitcoin
  • Ethereum
  • Regulation
  • Market
  • Blockchain
  • Business
  • Guide
  • Contact Us
No Result
View All Result
  • Home
    • Home – Layout 1
  • Bitcoin
  • Ethereum
  • Regulation
  • Market
  • Blockchain
  • Business
  • Guide
  • Contact Us
No Result
View All Result
Approx Foundation
No Result
View All Result
Home Bitcoin

sha256 – Bitcoin core code (27.99) HashWriter hex strings problem

Moussa by Moussa
January 27, 2025
in Bitcoin
0
peer discovery – how to obtain the IP addresses of nodes for mining pools?
189
SHARES
1.5k
VIEWS
Share on FacebookShare on Twitter


I’m working on an Altcoin, and I’m getting different hashes for the same hex string when hashed using the HashWriter class of the bitcoin core code (27.99) and when hashed with the bcrypto lib of the JavaScript.

The issue is only with the hex strings, while numbers when hashed their hashes are matching and no problems (this proofs that the same hashing algorithm is used in both bitcoin core code and the bcrypto lib in JS).


For numbers:

C++:

Related articles

Robbers Tied up a UK Crypto Trader at Knifepoint and Took $800K

Robbers Tied up a UK Crypto Trader at Knifepoint and Took $800K

October 13, 2026
Gen Z Job-Hops to Level up as 75% Plan a Switch Within Six Months

Gen Z Job-Hops to Level up as 75% Plan a Switch Within Six Months

October 13, 2026
uint32_t timestamp = 1737835291;
HashWriter{} << st.timestamp).GetHash().GetHex(); // results in (85b76e3a3eeff7da605b5de8349aaee931965d611fd903cb33146982e61cbb28)

JavaScript:

bcrypto.hash256(intToBytes(1737835291)).reverse().toString("hex"); // results in (85b76e3a3eeff7da605b5de8349aaee931965d611fd903cb33146982e61cbb28)

For hex strings:

C++:

std::string hexString = "073ff90209cde3a9ce4ccd23598fd1b50e6a1fe34f30bd7240587f0bde6f65af";
(HashWriter{} << hexString ).GetHash().GetHex(); results in (73e21e5a9038727c61aeee89c899bd45d7e935a306ede80388de131a99e14a75)

JavaScript:

bcrypto.hash256(Buffer.from("073ff90209cde3a9ce4ccd23598fd1b50e6a1fe34f30bd7240587f0bde6f65af", "hex")).reverse().toString("hex"); results in (1ec6958d1fae90326d8abe7eb9950de366262ff80a730641a6acdac5dfc4ddfe) which is differs from the result of the C++

I have used an online tool to check the hash of the hex (073ff90209cde3a9ce4ccd23598fd1b50e6a1fe34f30bd7240587f0bde6f65af) and got a result that matches the result of the JavaScript (1ec6958d1fae90326d8abe7eb9950de366262ff80a730641a6acdac5dfc4ddfe)

I have also manipulated the hex strings encoding (hex, utf8/ascii) in both C++ and JavaScript and I couldn’t find a matching point between the resulted hashes of the two codes.

I have tried (In the JavaScript code) to reverse the bytes of the hex string before hashing it, and this results in a different hash but still not matching the C++ hash.


Why this happening and how to get the same hash of the hex string in both codes?

Thanks,,,



Source link

Share76Tweet47

Related Posts

Robbers Tied up a UK Crypto Trader at Knifepoint and Took $800K

Robbers Tied up a UK Crypto Trader at Knifepoint and Took $800K

by Moussa
October 13, 2026
0

Key TakeawaysA crypto owner says robbers held him at knifepoint in the UK and took $800K in crypto earlier today.A...

Gen Z Job-Hops to Level up as 75% Plan a Switch Within Six Months

Gen Z Job-Hops to Level up as 75% Plan a Switch Within Six Months

by Moussa
October 13, 2026
0

Key Takeaways75% of Gen Z workers plan to explore a new role within six months, and only 13% expect to...

Ark Invest’s Lorenzo Valente: Bitcoin’s 5-Year Forecast

Ark Invest’s Lorenzo Valente: Bitcoin’s 5-Year Forecast

by Moussa
October 13, 2026
0

Bitcoin has been flat to down this year, but ARK Invest isn’t changing its view. Lorenzo Valente, Director of Research...

Parlays Push Kalshi Past $3.9 Billion in a Day, Twice in a Weekend

Parlays Push Kalshi Past $3.9 Billion in a Day, Twice in a Weekend

by Moussa
October 13, 2026
0

Key TakeawaysKalshi’s notional volume reached a record $3.91 billion on Saturday and $3.96 billion on Sunday.Combos made up 71.6% of...

CFTC Crypto Rules Face 2028 Election Risk

CFTC Crypto Rules Face 2028 Election Risk

by Moussa
October 13, 2026
0

Join Our Telegram channel to stay up to date on breaking news coverage TD Cowen warns CFTC crypto rules may...

Load More

youssufi.com

sephina.com

[vc_row full_width="stretch_row" parallax="content-moving" vc_row_background="" background_repeat="no-repeat" background_position="center center" footer_scheme="dark" css=".vc_custom_1517813231908{padding-top: 60px !important;padding-bottom: 30px !important;background-color: #191818 !important;background-position: center;background-repeat: no-repeat !important;background-size: cover !important;}" footer_widget_title_color="#fcbf46" footer_button_bg="#fcb11e"][vc_column width="1/4"]

We bring you the latest in Crypto News

[/vc_column][vc_column width="1/4"][vc_wp_categories]
[/vc_column][vc_column width="1/4"][vc_wp_tagcloud taxonomy="post_tag"][/vc_column][vc_column width="1/4"]

Newsletter

[vc_raw_html]JTNDcCUzRSUzQ2RpdiUyMGNsYXNzJTNEJTIydG5wJTIwdG5wLXN1YnNjcmlwdGlvbiUyMiUzRSUwQSUzQ2Zvcm0lMjBtZXRob2QlM0QlMjJwb3N0JTIyJTIwYWN0aW9uJTNEJTIyaHR0cHMlM0ElMkYlMkZhcHByb3gub3JnJTJGJTNGbmElM0RzJTIyJTNFJTBBJTBBJTNDaW5wdXQlMjB0eXBlJTNEJTIyaGlkZGVuJTIyJTIwbmFtZSUzRCUyMm5sYW5nJTIyJTIwdmFsdWUlM0QlMjIlMjIlM0UlM0NkaXYlMjBjbGFzcyUzRCUyMnRucC1maWVsZCUyMHRucC1maWVsZC1maXJzdG5hbWUlMjIlM0UlM0NsYWJlbCUyMGZvciUzRCUyMnRucC0xJTIyJTNFRmlyc3QlMjBuYW1lJTIwb3IlMjBmdWxsJTIwbmFtZSUzQyUyRmxhYmVsJTNFJTBBJTNDaW5wdXQlMjBjbGFzcyUzRCUyMnRucC1uYW1lJTIyJTIwdHlwZSUzRCUyMnRleHQlMjIlMjBuYW1lJTNEJTIybm4lMjIlMjBpZCUzRCUyMnRucC0xJTIyJTIwdmFsdWUlM0QlMjIlMjIlM0UlM0MlMkZkaXYlM0UlMEElM0NkaXYlMjBjbGFzcyUzRCUyMnRucC1maWVsZCUyMHRucC1maWVsZC1lbWFpbCUyMiUzRSUzQ2xhYmVsJTIwZm9yJTNEJTIydG5wLTIlMjIlM0VFbWFpbCUzQyUyRmxhYmVsJTNFJTBBJTNDaW5wdXQlMjBjbGFzcyUzRCUyMnRucC1lbWFpbCUyMiUyMHR5cGUlM0QlMjJlbWFpbCUyMiUyMG5hbWUlM0QlMjJuZSUyMiUyMGlkJTNEJTIydG5wLTIlMjIlMjB2YWx1ZSUzRCUyMiUyMiUyMHJlcXVpcmVkJTNFJTNDJTJGZGl2JTNFJTBBJTNDZGl2JTIwY2xhc3MlM0QlMjJ0bnAtZmllbGQlMjB0bnAtcHJpdmFjeS1maWVsZCUyMiUzRSUzQ2xhYmVsJTNFJTNDaW5wdXQlMjB0eXBlJTNEJTIyY2hlY2tib3glMjIlMjBuYW1lJTNEJTIybnklMjIlMjByZXF1aXJlZCUyMGNsYXNzJTNEJTIydG5wLXByaXZhY3klMjIlM0UlQzIlQTBCeSUyMGNvbnRpbnVpbmclMkMlMjB5b3UlMjBhY2NlcHQlMjB0aGUlMjBwcml2YWN5JTIwcG9saWN5JTNDJTJGbGFiZWwlM0UlM0MlMkZkaXYlM0UlM0NkaXYlMjBjbGFzcyUzRCUyMnRucC1maWVsZCUyMHRucC1maWVsZC1idXR0b24lMjIlM0UlM0NpbnB1dCUyMGNsYXNzJTNEJTIydG5wLXN1Ym1pdCUyMiUyMHR5cGUlM0QlMjJzdWJtaXQlMjIlMjB2YWx1ZSUzRCUyMlN1YnNjcmliZSUyMiUyMCUzRSUwQSUzQyUyRmRpdiUzRSUwQSUzQyUyRmZvcm0lM0UlMEElM0MlMkZkaXYlM0UlM0NiciUyRiUzRSUzQyUyRnAlM0U=[/vc_raw_html][/vc_column][/vc_row]
No Result
View All Result
  • Contact Us
  • Homepages
  • Business
  • Guide

© 2024 APPROX FOUNDATION - The Crypto Currency News