Say I have an object that stores a byte array and I want to be able to efficiently generate a hashcode for it. I\'ve used the cryptographic hash functions for this in the pa
private int? hashCode; public override int GetHashCode() { if (!hashCode.HasValue) { var hash = 0; for (var i = 0; i < bytes.Length; i++) { hash = (hash << 4) + bytes[i]; } hashCode = hash; } return hashCode.Value; }