From 75addfb1859889f0277401c15c5c897f025bf6d6 Mon Sep 17 00:00:00 2001 From: barelyprofessional <150058423+barelyprofessional@users.noreply.github.com> Date: Fri, 13 Mar 2026 20:24:30 -0500 Subject: [PATCH] Very good saar claude cood to make pow accept --- KfChatDotNetBot/Services/KiwiFlare.cs | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/KfChatDotNetBot/Services/KiwiFlare.cs b/KfChatDotNetBot/Services/KiwiFlare.cs index 068b344..9f99c41 100644 --- a/KfChatDotNetBot/Services/KiwiFlare.cs +++ b/KfChatDotNetBot/Services/KiwiFlare.cs @@ -69,23 +69,18 @@ public class KiwiFlare(string kfDomain, string? proxy = null, CancellationToken? IsTtrs = pow == "ttrs" }; } - - // 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) { - var bitArray = new BitArray(hash); - var i = 0; - // BitArrays can't be sliced so just step through it - while (i < difficulty) + for (var i = 0; i < difficulty; i++) { - // If any of the bits are set to 1, it's not a valid hash - if (bitArray[i]) + var byteIndex = i / 8; + var bitIndex = 7 - (i % 8); // MSB first within each byte + if ((hash[byteIndex] & (1 << bitIndex)) != 0) { return false; } - i++; } - // If we got this far, means they were all zero! return true; }