public void CalculateDifference(byte[] current, byte[] previous, long length) { // Reset diffBits.Clear(); int index; diffLength = 0; int count = 0; // Calculate differences for (int i = 0; i < signature.Length; i++) { index = signature[i]; if (current[index] != previous[index]) { diffBits.Add(true); difference[diffLength] = current[index]; diffLength++; count = i; } else { diffBits.Add(false); } } // Reduce diff bit count to eliminate final matching bytes. diffBits.BitCount = count + 1; }