Browse files

Merge pull request #61 from KushalP/master

Simplify the equality check against 0
  • Loading branch information...
2 parents 3bdf0d3 + 888a529 commit cf038f73e0fd2ea734a95b8075827e6436cbeeca @weavejester weavejester committed Mar 17, 2012
Showing with 3 additions and 6 deletions.
  1. +3 −6 ring-core/src/ring/middleware/session/cookie.clj
View
9 ring-core/src/ring/middleware/session/cookie.clj
@@ -79,12 +79,9 @@
(defn- secure-compare [^String a ^String b]
(if (and a b (= (.length a) (.length b)))
- (= 0
- (reduce bit-or
- (map bit-xor
- (.getBytes a)
- (.getBytes b))))
- false))
+ (zero? (reduce bit-or
+ (map bit-xor (.getBytes a) (.getBytes b))))
+ false))
(defn- unseal
"Retrieve a sealed Clojure data structure from a string"

0 comments on commit cf038f7

Please sign in to comment.