MultiversX Tracker is Live!

Need help with the internals w(0 to 15) and h(0 to 7) of the SHA256 for Bitcoin

Bitcoin Reddit

More / Bitcoin Reddit 60 Views

For each block has a block header consisting of the following: version, previous hash (reversed), merkle hash (reversed), timestamp (little endian), bits/difficulty (little endian) and nonce (little endian), and padding (zeros).

This block header spans over 2 hashes since each SHA256 hash can only take in 64 bytes of the block header at one time and the block header is 80 bytes plus padding. The 64 bytes is broken down into 16 words labeled w(0) to w(15).

So in the first hash: w(0) is the version, w(1) to w8) is the previous hash reversed, w(9) to w(15) is most of the merkle hash reversed (except for the last 4 bytes.

The 2nd hash: w(0) is the last 4 bytes of the merkle hash reversed, w(1) is the timestamp, w(2) is the difficulty "bits", w(3) is the nonce, w(4) to w(15) is the padding (zeros) + length. What exactly is this?

In the first hash, the beginning values for a to h are contant values (I think they are labeled h0 to h7). And I think for the 2nd hash these initial values are the hash result from the first hash.

Finally there is a 3rd hash: w(0) to w(15) is padding (zeros) + length. What exactly is this? This hash uses the constants again for h0 to h7 similar to the first hash.

Does this look right? And how do I determine the padding and length?

submitted by /u/Plus-Philosopher7876
[link] [comments]
Get BONUS $200 for FREE!

You can get bonuses upto $100 FREE BONUS when you:
πŸ’° Install these recommended apps:
πŸ’² SocialGood - 100% Crypto Back on Everyday Shopping
πŸ’² xPortal - The DeFi For The Next Billion
πŸ’² CryptoTab Browser - Lightweight, fast, and ready to mine!
πŸ’° Register on these recommended exchanges:
🟑 Binance🟑 Bitfinex🟑 Bitmart🟑 Bittrex🟑 Bitget
🟑 CoinEx🟑 Crypto.com🟑 Gate.io🟑 Huobi🟑 Kucoin.



Comments