ソースコードをレビューした。さらに最適化するアイデアがいくつかあり、4way が部分的に壊れていることに気づいた:
main.cpp より:
for (int j = 0; j < NPAR; j++)
{
if (thash[7][j] == 0)
{
for (int i = 0; i < sizeof(hash)/4; i++)
((unsigned int*)&hash)[i] = thash[i][j];
pblock->nNonce = ByteReverse(tmp.block.nNonce + j);
}
}
このコードは、正しいものである可能性のある 32個のハッシュのうち、1 つ(thash[7] == 0 の最後のもの)しか処理しない。
こんな感じで修正できるはずだが、より高い難易度では安全ではないだろう。また、バイト順序を反転すべきかどうかもわからない。誰かレビューしてくれないか?
unsigned int min_hash = ~1;
for (int j = 0; j < NPAR; j++)
{
if (thash[7][j] == 0)
{
if(thash[6][j] < min_hash) {
min_hash = thash[6][j];
for (int i = 0; i < sizeof(hash)/4; i++)
((unsigned int*)&hash)[i] = thash[i][j];
pblock->nNonce = ByteReverse(tmp.block.nNonce + j);
}
}
}