You can compare two sequences of equal length with Zip:
static int CompareSequenceTo<T>(this IEnumerable<T> a, IEnumerable<T> b) where T : IComparable<T> {
return a
.Zip(b, (x, y) => x.CompareTo(y))
.FirstOrDefault(r => r != 0);
}
Applied to a difficulty a and hash b, it correctly reports that a is less than b:
byte[] a = {0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
byte[] b = {0x8f, 0xc3, 0xde, 0x5d, 0x79, 0x2f, 0x2e, 0x6b, 0x31, 0x18, 0x69, 0x7d, 0x1e, 0x5b, 0xaa, 0x40, 0x54, 0x00, 0xe9, 0xf8, 0xf0, 0x96, 0x25, 0xd7, 0xee, 0xd1, 0x48, 0x1e, 0xe0, 0xb0, 0x9f, 0xc8};
Console.WriteLine(a.CompareSequenceTo(b)); // some value less than zero