public static bool CompareTo(this byte[] buf1, byte[] buf2)
{
if (ReferenceEquals(buf1, buf2)) return true;
if ((buf1 == null && buf2 != null) || (buf1 != null && buf2 == null)) return false;
if (buf1.Length != buf2.Length) return false;
for (int i = 0; i < buf1.Length; i++) if (buf1[i] != buf2[i]) return false;
return true;
}