From 0a20c5bb737aa7ea20c25b5d4006f3e8238c3519 Mon Sep 17 00:00:00 2001 From: kalmarek Date: Mon, 30 Jul 2018 15:00:02 +0200 Subject: [PATCH] change hashing constant for reproducible hash of Automorphisms --- src/AutGroup.jl | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/AutGroup.jl b/src/AutGroup.jl index cb4fa36..479514e 100644 --- a/src/AutGroup.jl +++ b/src/AutGroup.jl @@ -223,14 +223,14 @@ end # ############################################################################### -const HASHINGCONST = 0x314a5215305f3ec1 # more or less random +const HASHINGCONST = 0x7d28276b01874b19 # hash(Automorphism) hash(s::AutSymbol, h::UInt) = hash(s.str, hash(s.pow, hash(:AutSymbol, h))) function hash(g::Automorphism, h::UInt) if g.modified - g.savedhash = hash(reduce!.(g(domain(parent(g)))), - hash(typeof(g), hash(parent(g), HASHINGCONST))) + g_im = reduce!.(g(domain(parent(g)))) + g.savedhash = hash(g_im, hash(typeof(g), hash(parent(g), HASHINGCONST))) g.modified = false end return xor(g.savedhash, h) @@ -249,11 +249,9 @@ function (==)(g::Automorphism{N}, h::Automorphism{N}) where N g_im = reduce!.(g(domain(parent(g)))) h_im = reduce!.(h(domain(parent(h)))) # cheap: - g.savedhash = hash(g_im, - hash(typeof(g), hash(parent(g), HASHINGCONST))) + g.savedhash = hash(g_im, hash(typeof(g), hash(parent(g), HASHINGCONST))) g.modified = false - h.savedhash = hash(h_im, - hash(typeof(h), hash(parent(h), HASHINGCONST))) + h.savedhash = hash(h_im, hash(typeof(h), hash(parent(h), HASHINGCONST))) h.modified = false return g_im == h_im