/// <remarks>Assumes all characters are ASCII bytes (ie, <=0xFF)</remarks> public static uint Hash(string buffer, uint seed = 0) { Contract.Requires(buffer != null); int length = buffer.Length; int index = 0; HashState state = new HashState(seed); for (; index + kBlockSize <= length;) { state.ProcessBlock(buffer, ref index); } state.ProcessFinalBlock(buffer, ref index, length); return(state.Result); }
/// <remarks>Assumes all characters are ASCII bytes (ie, <=0xFF)</remarks> public static uint Hash(char[] buffer, uint seed = 0, int index = 0, int length = -1) { Contract.Requires(buffer != null); if (length.IsNone()) { length = buffer.Length - index; } HashState state = new HashState(seed); for (; index + kBlockSize <= length;) { state.ProcessBlock(buffer, ref index); } state.ProcessFinalBlock(buffer, ref index, length); return(state.Result); }