mirror of
https://github.com/barelyprofessional/KfChatDotNet.git
synced 2026-05-02 04:22:04 -04:00
Very good saar claude cood to make pow accept
This commit is contained in:
@@ -70,22 +70,17 @@ public class KiwiFlare(string kfDomain, string? proxy = null, CancellationToken?
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
// A hash is considered solved if the first number of bits (as defined by difficulty) are all zero
|
|
||||||
private bool TestHash(byte[] hash, int difficulty)
|
private bool TestHash(byte[] hash, int difficulty)
|
||||||
{
|
{
|
||||||
var bitArray = new BitArray(hash);
|
for (var i = 0; i < difficulty; i++)
|
||||||
var i = 0;
|
|
||||||
// BitArrays can't be sliced so just step through it
|
|
||||||
while (i < difficulty)
|
|
||||||
{
|
{
|
||||||
// If any of the bits are set to 1, it's not a valid hash
|
var byteIndex = i / 8;
|
||||||
if (bitArray[i])
|
var bitIndex = 7 - (i % 8); // MSB first within each byte
|
||||||
|
if ((hash[byteIndex] & (1 << bitIndex)) != 0)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
i++;
|
|
||||||
}
|
}
|
||||||
// If we got this far, means they were all zero!
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user