BCNet.Utils.HashCompare C# (CSharp) Method

HashCompare() public static method

public static HashCompare ( byte hashA, byte hashB ) : bool
hashA byte
hashB byte
return bool
        public static bool HashCompare(byte[] hashA, byte[] hashB)
        {
            if (hashA.Length != 32)
                return false;
            if (hashB.Length != 32)
                return false;

            for (int i = 0; i < 32; i++)
            {
                if (hashA[i] != hashB[i])
                    return false;
            }

            return true;
        }

Usage Example

        Block FindBlock(byte[] hash)
        {
            Block found = null;

            mBlockLock.WaitOne();
            foreach (Block b in mBlocks)
            {
                if (Utils.HashCompare(b.mHeader.mHash, hash))
                {
                    found = b;
                    break;
                }
            }
            mBlockLock.ReleaseMutex();

            return(found);
        }
All Usage Examples Of BCNet.Utils::HashCompare