-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

I have written a cryptographic hash function for edn semantics:

https://github.com/ghubber/hasch

Is this what you need? If you are interested, atm. I have to
investigate ways to make it as fast (while still safe) as possible.
Version 0.2.3 works fine though (it is just not optimized for high speed).

Christian


On 05.01.2015 20:30, Feng Xue wrote:
> These days, I was trying to utilize function hash in
> clojure/clojurescript to generate unique id, but it turns out this
> function has very strange behaviour to empty vector parsed from
> read-string in cljs with in clj.
> 
> In clojure, hash function return -2017569654 for empty vector and
> the one parsed from read-string
> 
> user=> (hash []) -2017569654 user=> (hash (read-string "[]")) 
> -2017569654
> 
> However, in cljs, (hash []) returns surprisingly 0. And [] are also
> equal to (read-string "[]").
> 
> cljs.user=> (hash (cljs.reader/read-string "[]")) -2017569654
> 
> cljs.user=> (hash []) 0
> 
> cljs.user=> (= [] (cljs.reader/read-string "[]")) true
> 
> Does any one know the reason of it and how to solve it in cljs?
> 

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1

iQEcBAEBAgAGBQJUqvbUAAoJEKel+aujRZMkN28H/j00CQ+TB5NWwOzfQAfSgl8j
lcTRU83hLeqTLNQK+FJ9tw/CedL7wnLNykwKPbbkrGh9BISYAKI5N7d8w8ROSOFp
DAeCmZ5ouHHWXx7FbnOAaTyvxMe/xnLXuzAw4MyTda0ElPhWu0cwYNAdTxzd+ogW
X2/u9EzPd9txESobJJdtvBygYsCXVr9JhgDnlomJKulFyTy1/MBUhY5nc4atkfwk
b6mgePE1SP1rPgv++KV5XfxpbsU4fNVDNbHUH/0e5BSkyM4DB4x7VHncg0bzPw4B
eg7C6gtuxJob7ol+lw6TiAM4nuHBOlHp5lwBU+d42/HQn/tn57Y8K1R2HRFF2y0=
=SOlV
-----END PGP SIGNATURE-----

-- 
Note that posts from new members are moderated - please be patient with your 
first post.
--- 
You received this message because you are subscribed to the Google Groups 
"ClojureScript" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/clojurescript.

Reply via email to