CSharp examples for System:Byte
Compute Binary Hash Code
using System.Diagnostics; using System.Collections.Generic; public class Main{ internal static int ComputeBinaryHashCode(byte[] bytes) {//from w w w .j av a 2s . co m Debug.Assert(bytes != null, "Byte array cannot be null"); var hashCode = 0; for (int i = 0, n = Math.Min(bytes.Length, 7); i < n; i++) { hashCode = ((hashCode << 5) ^ bytes[i]); } return hashCode; } }