<div dir="ltr"><div dir="ltr"><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Sep 2, 2019 at 12:37 PM Richard O'Keefe <<a href="mailto:raoknz@gmail.com">raoknz@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div style="font-family:monospace,monospace">Hashing maps using xor? Oh dear. That's really not a good method.</div><div style="font-family:monospace,monospace">I found a much better way to hash sets and maps, but couldn't find</div><div style="font-family:monospace,monospace">a journal that thought it was in their scope. Actually, there are</div><div style="font-family:monospace,monospace">several good ways.</div><div style="font-family:monospace,monospace"><br></div><div style="font-family:monospace,monospace">Now you are locked into an inferior one.</div></div></blockquote><div><br></div><div>If you have any links to better methods it would be great to have them if we ever decide to make a phash3 :) or maybe we can improve our internal hash used by ets and friends that don't need to work across versions.</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, 29 Aug 2019 at 03:19, Lukas Larsson <<a href="mailto:lukas@erlang.org" target="_blank">lukas@erlang.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div dir="ltr"><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Aug 28, 2019 at 8:45 AM Frans Schneider <<a href="mailto:fchschneider@gmail.com" target="_blank">fchschneider@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hi list,<br>
<br>
According to the docs, the erlang:phash2/2 will return the same result <br>
regardless of machine architecture and ERTS version. Does this imply <br>
that this is still true in case the implementation of a basic type, lets <br>
say a list or map (#{}), will change in the future? Can I assume that <br>
calculating a hash for a list will have the same result now and in the <br>
future?<br></blockquote><div><br></div><div>Yes. The way hashing of maps works is that it hashes each k/v pair and then takes the xor of each of those hashes. Since a series of xor's can be applied in any order without changing the result, the hash value will always be the same.</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
Thanks<br>
<br>
<br>
Frans<br>
<br>
_______________________________________________<br>
erlang-questions mailing list<br>
<a href="mailto:erlang-questions@erlang.org" target="_blank">erlang-questions@erlang.org</a><br>
<a href="http://erlang.org/mailman/listinfo/erlang-questions" rel="noreferrer" target="_blank">http://erlang.org/mailman/listinfo/erlang-questions</a><br>
</blockquote></div></div>
_______________________________________________<br>
erlang-questions mailing list<br>
<a href="mailto:erlang-questions@erlang.org" target="_blank">erlang-questions@erlang.org</a><br>
<a href="http://erlang.org/mailman/listinfo/erlang-questions" rel="noreferrer" target="_blank">http://erlang.org/mailman/listinfo/erlang-questions</a><br>
</blockquote></div>
_______________________________________________<br>
erlang-questions mailing list<br>
<a href="mailto:erlang-questions@erlang.org" target="_blank">erlang-questions@erlang.org</a><br>
<a href="http://erlang.org/mailman/listinfo/erlang-questions" rel="noreferrer" target="_blank">http://erlang.org/mailman/listinfo/erlang-questions</a><br>
</blockquote></div></div>