private void AssertSHA1(string expectedHash, Span <byte> data, bool matches = true) { System.Security.Cryptography.SHA1 sha1 = System.Security.Cryptography.SHA1.Create(); byte[] dest = new byte[sha1.HashSize / 8]; Assert.True(sha1.TryComputeHash(data, dest, out _)); string hashString = dest.ToHexString(); if (matches) { Assert.Equal(expectedHash, hashString, true); } else { Assert.NotEqual <string>(expectedHash, hashString, StringComparer.InvariantCultureIgnoreCase); } }