• 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

Taiwanese Crypto Exchange Founder Charged For $10M Fraud

World Liberty Sues Sun For Defamation

May 5, 2026

No CLARITY Act Needed? XRP Could Be Ready For Its Next Big Surge

May 5, 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

Taiwanese Crypto Exchange Founder Charged For $10M Fraud

World Liberty Sues Sun For Defamation

by Moussa
May 5, 2026
0

Trusted Editorial content, reviewed by leading industry experts and seasoned editors. Ad Disclosure In the latest development of the fight...

No CLARITY Act Needed? XRP Could Be Ready For Its Next Big Surge

by Moussa
May 5, 2026
0

They say journalists never truly clock out. But for Christian, that's not just a metaphor, it's a lifestyle. By day,...

Bitcoin Price Reclaims $80,000 Amid Surging ETF Demand, Positive Iran News

Bitcoin Price Reclaims $80,000 Amid Surging ETF Demand, Positive Iran News

by Moussa
May 5, 2026
0

Bitcoin price crossed the $80,000 threshold late Sunday and into today, posting a brief 2% gain over 24 hours to...

Haun Ventures Unveils $1 Billion Fund to Build the Next Financial System

Haun Ventures Unveils $1 Billion Fund to Build the Next Financial System

by Moussa
May 5, 2026
0

Key Takeaways: Haun Ventures launched a $1 billion fund to back startups building the next-generation financial system. Unlike its $1.5B...

How do Bitcoin mining pools typically handle payout frequency versus thresholds?

wallet – Trying to recover old BTC from a pre-2013 centralized exchange — I have my email, a 5-digit code and an MD5-like hash, but don’t remember the platfor

by Moussa
May 5, 2026
0

Back around 2012–2013, I purchased some Bitcoin on what I believe was a centralized exchange. I never touched them since,...

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