Re:Why you should never use hash functions for message authe...
by gchpaco on Saturday June 09, 2012 @06:36PM
(#4089538)
Compiler optimizations, CPU pipeline and branch prediction would be my guess, although I'm sure someone else can jump in with more detail. XOR is basically immune to optimized tricks.
Re:Why you should never use hash functions for message authe...
by reitzensteinm on Saturday June 09, 2012 @10:18PM
(#4089973)
Ah, that does make sense. Thanks!
I see how the xor method works, but not why it's superior.
Also, it would seem that you'd be leaking information about the size of the other string with either method (whether you exit early or not when you run past the length of one of the strings) - not a problem when comparing hashes presumably, but is it never a concern?
I don't think you'd be leaking that information if you hashed both strings and compared the hash, because it wouldn't stop getting faster when the shorter string gets shorter.