According this reference source code, the function SlowEquals
private static bool SlowEquals(byte[] a, byte[] b)
{
uint diff = (uint)a.Length ^ (uint)b.Length;
for (int i = 0; i < a.Length && i < b.Length; i++)
diff |= (uint)(a[i] ^ b[i]);
return diff == 0;
}
I got the author's point to use xor & or to make the compare-time to be
consistent, but now I'm quite confused about the BCrypt's password
verification, is it need to do the same thing to avoid timing-attack?
Or the bcrypt already been adjust to be consistent after hashing it?
So it just verifies the result with "=="?
Any ideas or document/articles about this? Thanks.