Changed the JSON object hashing procedure to use a symmetric operator to disregard key order in object hashes

This commit is contained in:
Peter Munch-Ellingsen 2016-03-29 18:06:48 +02:00
commit 794f9527da

View file

@ -786,7 +786,7 @@ proc hash*(n: JsonNode): Hash =
proc hash*(n: Table[string, JsonNode]): Hash =
for key, val in n:
result = result !& hash(key) !& hash(val)
result = result xor (hash(key) !& hash(val))
result = !$result
proc len*(n: JsonNode): int =