1lann / krist-miner

The second fastest open source CPU Krist miner, written in Go.
MIT License
6 stars 5 forks source link

Incorrect hash score calculation #1

Closed dmarcuse closed 8 years ago

dmarcuse commented 8 years ago

Your hash value calculation code is incorrect. You need to use the first six bytes of the hash - not the last six.

Here is the code that I use in my OpenCL miner to get the score of a hash:

long hashToLong(byte* hash) {
    return hash[5] + (hash[4] << 8) + (hash[3] << 16) + ((long)hash[2] << 24) + ((long) hash[1] << 32) + ((long) hash[0] << 40);
}

It's been optimized as much as possible (AFAIK) while still retaining accuracy.

1lann commented 8 years ago

Oh huh, I've been told wrong! Thanks for letting me know.

dmarcuse commented 8 years ago

No problem.