Hash each item before doing the comparison.

By taking a hash of the two strings we can guarantee that they'll be the
same length when compared by the constant time function.