Skip to content

Commit

Permalink
Release 0.3.5.
Browse files Browse the repository at this point in the history
  • Loading branch information
whilo committed May 23, 2018
1 parent 0e7e91e commit 7d5654a
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 4 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,8 @@ nil


# Changes
- 0.3.5 Support BigInteger and BigDecimal hashing (same as for limited precision types).
- 0.3.4 Expose high-level base64 hashes with full precision.
- 0.3.2 Minimize dependencies, explicit profiles for different Clojure(Script) versions
- 0.3.1 fix bug in hashing sequences containing null
- 0.3.0 fix accidental hashing of records as maps
Expand Down
4 changes: 2 additions & 2 deletions project.clj
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
(defproject io.replikativ/hasch "0.3.5-SNAPSHOT"
(defproject io.replikativ/hasch "0.3.5"
:description "Cryptographic hashing of EDN datastructures."
:url "http://github.com/replikativ/hasch"
:license {:name "Eclipse Public License"
:url "http://www.eclipse.org/legal/epl-v10.html"}
:dependencies [[org.clojure/clojure "1.9.0-alpha14" :scope "provided"]
[org.clojure/clojurescript "1.9.293" :scope "provided"]
[io.replikativ/incognito "0.2.1"]
[io.replikativ/incognito "0.2.2"]
[org.clojure/data.codec "0.1.1"]]
:source-paths ["src"]
:plugins [[lein-cljsbuild "1.1.4"]]
Expand Down
8 changes: 8 additions & 0 deletions src/hasch/platform.clj
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,10 @@ Our hash version is coded in first 2 bits."
(-coerce [this md-create-fn write-handlers]
(encode (:number magics) (.getBytes (.toString this) "UTF-8")))

java.math.BigInteger
(-coerce [this md-create-fn write-handlers]
(encode (:number magics) (.getBytes (.toString this) "UTF-8")))

java.lang.Float
(-coerce [this md-create-fn write-handlers]
(encode (:number magics) (.getBytes (.toString this) "UTF-8")))
Expand All @@ -89,6 +93,10 @@ Our hash version is coded in first 2 bits."
(-coerce [this md-create-fn write-handlers]
(encode (:number magics) (.getBytes (.toString this) "UTF-8")))

java.math.BigDecimal
(-coerce [this md-create-fn write-handlers]
(encode (:number magics) (.getBytes (.toString this) "UTF-8")))

java.util.UUID
(-coerce [this md-create-fn write-handlers]
(encode (:uuid magics) (.getBytes (.toString this) "UTF-8")))
Expand Down
7 changes: 5 additions & 2 deletions test/hasch/test.cljc
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,15 @@
(is (= (edn-hash "小鳩ちゃんかわいいなぁ")
'(2 191 84 39 34 44 227 102 135 109 17 136 159 80 253 7 40 0 170 134 198 204 137 10 194 21 113 203 2 87 125 80 172 165 111 110 222 7 123 138 148 124 207 180 240 207 91 6 248 28 53 168 143 30 106 103 101 82 133 215 69 35 93 47)))

(is (= (edn-hash 1234567890)
(is (= (edn-hash (int 1234567890))
(edn-hash (long 1234567890))
#?(:clj (edn-hash (BigInteger. "1234567890")))
'(65 199 158 164 193 95 213 144 233 29 41 86 123 106 110 215 117 225 149 249 204 124 220 217 226 120 131 178 61 133 39 228 182 233 235 249 10 249 141 122 101 25 46 134 18 222 175 224 134 61 167 114 15 109 2 146 38 65 1 55 128 137 144 55)))

(is (= (edn-hash (double 123.1))
(edn-hash (float 123.1))
'(155 181 33 252 126 113 188 20 210 155 50 24 125 212 205 160 135 108 90 43 154 65 61 229 226 83 11 110 64 61 124 45 43 186 152 127 64 171 171 154 28 149 180 136 229 69 195 145 126 99 56 14 48 194 180 126 212 83 123 206 36 189 189 167)))
'(155 181 33 252 126 113 188 20 210 155 50 24 125 212 205 160 135 108 90 43 154 65 61 229 226 83 11 110 64 61 124 45 43 186 152 127 64 171 171 154 28 149 180 136 229 69 195 145 126 99 56 14 48 194 180 126 212 83 123 206 36 189 189 167)
#?(:clj (edn-hash (BigDecimal. "123.1")))))

(is (= (edn-hash :core/test)
'(62 51 214 78 41 84 37 205 69 197 105 26 235 55 30 87 46 117 187 194 101 184 139 244 111 232 98 175 16 174 182 211 11 171 154 64 90 18 229 93 188 246 33 234 102 145 68 30 92 0 81 208 210 10 124 137 203 18 249 138 226 253 60 62)))
Expand Down

0 comments on commit 7d5654a

Please sign in to comment.