Skip to content

fix(hash): match JVM Clojure hasheq for strings and records - #48

Merged
skydread1 merged 1 commit into
maint-1.11.xfrom
fix/string-hasheq-jvm-compat
Sep 9, 2026
Merged

fix(hash): match JVM Clojure hasheq for strings and records#48
skydread1 merged 1 commit into
maint-1.11.xfrom
fix/string-hasheq-jvm-compat

Conversation

@skydread1

@skydread1 skydread1 commented Sep 9, 2026

Copy link
Copy Markdown
Member

Closes #47

  • Util.hasheq hashes a string with Java's String.hashCode
  • APersistentMap/mapHasheq returns Murmur3.HashUnordered
  • data_structures.clj pins the JVM's numbers

.NET Core randomizes String.GetHashCode per process, so hash a string
with Java's String.hashCode instead. APersistentMap/mapHasheq returns
Murmur3.HashUnordered instead of the pre-1.6 sum of XORs, which the
defrecord macro bakes into every record's hasheq.

Taken from MAGIC bc629a6, not upstream's CLJCLR-142, which lands on a
value matching neither the JVM nor MAGIC.

Closes #47
@skydread1 skydread1 self-assigned this Sep 9, 2026
@skydread1
skydread1 merged commit 2d0c174 into maint-1.11.x Sep 9, 2026
3 checks passed
@skydread1
skydread1 deleted the fix/string-hasheq-jvm-compat branch September 9, 2026 02:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

(hash s) changes in every process, and a record's hash diverges from JVM Clojure

1 participant