public static void When_check_empty() { var expected = Sha1.Parse(Sha1TestVectors.Empty); // Empty Array singleton Sha1 actual = s_sha1.HashData(Array.Empty <byte>()); Assert.Equal(expected, actual); Assert.Equal(expected.GetHashCode(), actual.GetHashCode()); // Empty Array actual = s_sha1.HashData(new byte[0]); Assert.Equal(expected, actual); Assert.Equal(expected.GetHashCode(), actual.GetHashCode()); // Empty default ArraySegment actual = s_sha1.HashData(default(ArraySegment <byte>)); Assert.Equal(expected, actual); Assert.Equal(expected.GetHashCode(), actual.GetHashCode()); // Empty new ArraySegment actual = s_sha1.HashData(new ArraySegment <byte>(new byte[0], 0, 0)); Assert.Equal(expected, actual); Assert.Equal(expected.GetHashCode(), actual.GetHashCode()); // Empty default Span actual = s_sha1.HashData(default(Span <byte>)); Assert.Equal(expected, actual); Assert.Equal(expected.GetHashCode(), actual.GetHashCode()); // Empty new Span actual = s_sha1.HashData(new Span <byte>(new byte[0], 0, 0)); Assert.Equal(expected, actual); Assert.Equal(expected.GetHashCode(), actual.GetHashCode()); // Empty default ReadOnlySpan actual = s_sha1.HashData(default(ReadOnlySpan <byte>)); Assert.Equal(expected, actual); Assert.Equal(expected.GetHashCode(), actual.GetHashCode()); // Empty new ReadOnlySpan actual = s_sha1.HashData(new ReadOnlySpan <byte>(new byte[0], 0, 0)); Assert.Equal(expected, actual); Assert.Equal(expected.GetHashCode(), actual.GetHashCode()); // Empty String actual = s_sha1.HashData(string.Empty); Assert.Equal(expected, actual); Assert.Equal(expected.GetHashCode(), actual.GetHashCode()); }
public override int GetHashCode() { unchecked { int hashCode = Size.GetHashCode(); hashCode = (hashCode * 397) + Url.GetHashCode(StringComparison.InvariantCulture); hashCode = (hashCode * 397) + Sha1.GetHashCode(StringComparison.InvariantCulture); return(hashCode); } }
/// <inheritdoc/> public override int GetHashCode() { unchecked { int result = Sha1?.GetHashCode() ?? 0; result = (result * 397) ^ (Sha1New?.GetHashCode() ?? 0); result = (result * 397) ^ (Sha256?.GetHashCode() ?? 0); result = (result * 397) ^ (Sha256New?.GetHashCode() ?? 0); return(result); } }
/// <inheritdoc/> public override int GetHashCode() { unchecked { int result = (Sha1 != null ? Sha1.GetHashCode() : 0); result = (result * 397) ^ (Sha1New != null ? Sha1New.GetHashCode() : 0); result = (result * 397) ^ (Sha256 != null ? Sha256.GetHashCode() : 0); result = (result * 397) ^ (Sha256New != null ? Sha256New.GetHashCode() : 0); return(result); } }
public override int GetHashCode() { int hash = 1; if (Error.Length != 0) { hash ^= Error.GetHashCode(); } if (Sha1.Length != 0) { hash ^= Sha1.GetHashCode(); } if (Values.Length != 0) { hash ^= Values.GetHashCode(); } if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } return(hash); }