The whole process of bitcoin mining was making sense to me until a moment of madness an hour ago, if there are 80 bytes of data to be processed in SHA-256, that's 640 bits of data to be processed in SHA-256.
In this 80 bytes we have: 4 bytes (version), previous block hash (32 bytes), merkle root (32 bytes), time (4 bytes), bits (4 bytes), nonce (4 bytes).
I thought SHA-256 accepted 512 bits of data, so that's 64 bytes of data. And on top of that, I need to add the length of the data to be processed in the last 64 bits of this 512 bits input but 64 bytes is well over the limit.
Then I saw that I would have to create basically two 512 bit input "blocks". The first block holds 512 out of the 640 input, and the second block holds the remaining 128 data bits, one bit to signal the end of the data and then padded up with 0s until the last 64 bits to indicate the length.
Can someone confirm if this is correct, and explain more on how this is done? I'm trying to implement my own SHA-256 module in VHDL since I couldn't find any but having more than a 256 input really makes it more confusing.
What am I missing here? Can someone help clear it up for me?