Please sign in to comment.
- Loading branch information...
|@@ -1,6 +1,11 @@|
|+ "Securely test sequences of data for equality.")|
|-(defn eq? [a b]|
|+ "Test whether two sequences of characters or bytes are equal in a way that|
|+ protects against timing attacks. Note that this does not prevent an attacker|
|+ from discovering the *length* of the data being compared."|
|+ [a b]|
|(let [a (map int a), b (map int b)]|
|(if (and a b (= (count a) (count b)))|
|(zero? (reduce bit-or (map bit-xor a b)))|