|
|
|
@ -4294,27 +4294,6 @@ int static FormatHashBlocks(void* pbuffer, unsigned int len)
@@ -4294,27 +4294,6 @@ int static FormatHashBlocks(void* pbuffer, unsigned int len)
|
|
|
|
|
return blocks; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
static const unsigned int pSHA256InitState[8] = |
|
|
|
|
{0x6a09e667, 0xbb67ae85, 0x3c6ef372, 0xa54ff53a, 0x510e527f, 0x9b05688c, 0x1f83d9ab, 0x5be0cd19}; |
|
|
|
|
|
|
|
|
|
void SHA256Transform(void* pstate, void* pinput, const void* pinit) |
|
|
|
|
{ |
|
|
|
|
SHA256_CTX ctx; |
|
|
|
|
unsigned char data[64]; |
|
|
|
|
|
|
|
|
|
SHA256_Init(&ctx); |
|
|
|
|
|
|
|
|
|
for (int i = 0; i < 16; i++) |
|
|
|
|
((uint32_t*)data)[i] = ByteReverse(((uint32_t*)pinput)[i]); |
|
|
|
|
|
|
|
|
|
for (int i = 0; i < 8; i++) |
|
|
|
|
ctx.h[i] = ((uint32_t*)pinit)[i]; |
|
|
|
|
|
|
|
|
|
SHA256_Update(&ctx, data, sizeof(data)); |
|
|
|
|
for (int i = 0; i < 8; i++) |
|
|
|
|
((uint32_t*)pstate)[i] = ctx.h[i]; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// Some explaining would be appreciated
|
|
|
|
|
class COrphan |
|
|
|
|
{ |
|
|
|
@ -4634,7 +4613,7 @@ void IncrementExtraNonce(CBlock* pblock, CBlockIndex* pindexPrev, unsigned int&
@@ -4634,7 +4613,7 @@ void IncrementExtraNonce(CBlock* pblock, CBlockIndex* pindexPrev, unsigned int&
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void FormatHashBuffers(CBlock* pblock, char* pmidstate, char* pdata, char* phash1) |
|
|
|
|
void FormatHashBuffers(CBlock* pblock, char* pdata, char* phash1) |
|
|
|
|
{ |
|
|
|
|
//
|
|
|
|
|
// Pre-build hash buffers
|
|
|
|
@ -4672,9 +4651,6 @@ void FormatHashBuffers(CBlock* pblock, char* pmidstate, char* pdata, char* phash
@@ -4672,9 +4651,6 @@ void FormatHashBuffers(CBlock* pblock, char* pmidstate, char* pdata, char* phash
|
|
|
|
|
for (unsigned int i = 0; i < sizeof(tmp)/4; i++) |
|
|
|
|
((unsigned int*)&tmp)[i] = ByteReverse(((unsigned int*)&tmp)[i]); |
|
|
|
|
|
|
|
|
|
// Precalc the first half of the first hash, which stays constant
|
|
|
|
|
SHA256Transform(pmidstate, &tmp.block, pSHA256InitState); |
|
|
|
|
|
|
|
|
|
memcpy(pdata, &tmp.block, 128); |
|
|
|
|
memcpy(phash1, &tmp.hash1, 64); |
|
|
|
|
} |
|
|
|
|