Browse files

Added docstrings

  • Loading branch information...
1 parent 50cf534 commit 40dcc498659c112a6bc6e5fc524ebc15c22eb09b @weavejester committed Sep 3, 2013
Showing with 7 additions and 2 deletions.
  1. +7 −2 src/crypto/equality.clj
@@ -1,6 +1,11 @@
-(ns crypto.equality)
+(ns crypto.equality
+ "Securely test sequences of data for equality.")
-(defn eq? [a b]
+(defn eq?
+ "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)))

0 comments on commit 40dcc49

Please sign in to comment.