uint256 CBlockHeader::GetHash() const { uint256 thash; // unsigned int profile = 0x0; // neoscrypt((unsigned char *) &nVersion, (unsigned char *) &thash, profile); lyra2z_hash(BEGIN(nVersion), BEGIN(thash)); return thash; }
int scanhash_lyra2z(int thr_id, struct work *work, uint32_t max_nonce, uint64_t *hashes_done) { size_t size = (int64_t) ((int64_t) 16 * 16 * 96); uint64_t *wholeMatrix = _mm_malloc(size, 64); uint32_t _ALIGN(128) hash[8]; uint32_t _ALIGN(128) endiandata[20]; uint32_t *pdata = work->data; uint32_t *ptarget = work->target; const uint32_t Htarg = ptarget[7]; const uint32_t first_nonce = pdata[19]; uint32_t nonce = first_nonce; if (opt_benchmark) ptarget[7] = 0x0000ff; for (int i=0; i < 19; i++) { be32enc(&endiandata[i], pdata[i]); } do { be32enc(&endiandata[19], nonce); lyra2z_hash(wholeMatrix, hash, endiandata); // lyra2z_hash(0, hash, endiandata); if (hash[7] <= Htarg && fulltest(hash, ptarget)) { work_set_target_ratio(work, hash); pdata[19] = nonce; *hashes_done = pdata[19] - first_nonce; _mm_free(wholeMatrix); return 1; } nonce++; } while (nonce < max_nonce && !work_restart[thr_id].restart); pdata[19] = nonce; *hashes_done = pdata[19] - first_nonce + 1; _mm_free(wholeMatrix); return 0; }