• 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

Arbitrum Foundation Funding Proposal Seeks $16M, 1,700 ETH And 230M ARB

Arbitrum DAO Votes On Grant Ban For Three Projects After Watchdog Cases

September 22, 2026
MiCA Deadline Puts EU Crypto Users And Exchanges On Notice

Coincheck Group Confirms Executive Chairperson Change In SEC Filing

September 22, 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

Arbitrum Foundation Funding Proposal Seeks $16M, 1,700 ETH And 230M ARB

Arbitrum DAO Votes On Grant Ban For Three Projects After Watchdog Cases

by Moussa
September 22, 2026
0

Trusted Editorial content, reviewed by leading industry experts and seasoned editors. Ad Disclosure TL;DR Arbitrum DAO is voting on grant...

MiCA Deadline Puts EU Crypto Users And Exchanges On Notice

Coincheck Group Confirms Executive Chairperson Change In SEC Filing

by Moussa
September 22, 2026
0

TL;DR Coincheck Group disclosed that Executive Chairperson Takashi Oyagi resigned effective September 21. The company said the resignation was for...

White Hats Move Over $4.5 In Bitcoins From Coldcard To Recovery Trust

White Hats Move Over $4.5 In Bitcoins From Coldcard To Recovery Trust

by Moussa
September 22, 2026
0

White hats have moved bitcoin from the hacked Coldcard signing devices to a trust for would-be victims to reclaim, Galaxy...

Here Are the Numbers – Bitcoin News

Here Are the Numbers – Bitcoin News

by Moussa
September 22, 2026
0

Key TakeawaysUpbit’s XRP-KRW pair logged $350M (₩481B) on Sept. 21, against $225.8M (₩308B) for BTC-KRW.XRP climbed about 19% on Upbit,...

XRPL Permission Delegation Begins Final Test for October Activation

XRPL Permission Delegation Begins Final Test for October Activation

by Moussa
September 22, 2026
0

The XRP Ledger’s PermissionDelegationV1_1 amendment has entered its final two-week activation window after receiving 29 validator votes in favor, according...

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