This comment is in the 0.9.3 miner.cpp bitcoin source, right above the ScanHash_CryptoPP
definition.
// // ScanHash scans nonces looking for a hash with at least some zero bits. // It operates on big endian data. Caller does the byte reversing. // All input buffers are 16-byte aligned. nNonce is usually preserved // between calls, but periodically or if nNonce is 0xffff0000 or above, // the block is rebuilt and nNonce starts over at zero. // unsigned int static ScanHash_CryptoPP...
- What does it mean that the input buffers are 16-byte aligned? Is that important for calculating the hash?
I notice that some of the parameters to this method are defined as follows:
char pmidstatebuf[32+16]; char* pmidstate = alignup<16>(pmidstatebuf);
char pdatabuf[128+16]; char* pdata = alignup<16>(pdatabuf);
char phash1buf[64+16]; char* phash1 = alignup<16>(phash1buf);
All of the arrays already have a length that is divisible by 16, what's the need for the extra 16 chars?
- And why only try 0xffff nonces? Is this just an artificial limit put so that the hashing doesn't take forever?