You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -53,6 +53,22 @@ public static class HashComparer
53
53
/// <returns><see langword="true"/> if the two byte arrays are equal; otherwise, <see langword="false"/>.</returns>
54
54
/// <exception cref="System.ArgumentNullException">Thrown if either <paramref name="left"/> or <paramref name="right"/> is <see langword="null"/>.</exception>
/// Compares two <see cref="ReadOnlySpan{Byte}"/> instances for equality in a way that is resistant to timing attacks.
62
+
/// </summary>
63
+
/// <remarks>This method performs a constant-time comparison to prevent timing attacks, which can occur when
64
+
/// the time taken to compare two values leaks information about their contents. The method ensures that the
65
+
/// comparison time depends only on the length of the <see cref="ReadOnlySpan{Byte}"/>, not their contents. <para> If the <see cref="ReadOnlySpan{Byte}"/> instances have different
66
+
/// lengths, the method returns <see langword="false"/> immediately.</para></remarks>
67
+
/// <param name="left">The first <see cref="ReadOnlySpan{Byte}"/> to compare. Cannot be <see langword="null"/>.</param>
68
+
/// <param name="right">The second <see cref="ReadOnlySpan{Byte}"/> to compare. Cannot be <see langword="null"/>.</param>
69
+
/// <returns><see langword="true"/> if the two <see cref="ReadOnlySpan{Byte}"/> instances are equal; otherwise, <see langword="false"/>.</returns>
70
+
/// <exception cref="System.ArgumentNullException">Thrown if either <paramref name="left"/> or <paramref name="right"/> is <see langword="null"/>.</exception>
/// <exception cref="System.ArgumentNullException">Thrown if either <paramref name="left"/> or <paramref name="right"/> is <see langword="null"/>.</exception>
0 commit comments