[erlang-questions] phash2 portability

Lukas Larsson lukas@REDACTED
Wed Aug 28 17:18:44 CEST 2019

On Wed, Aug 28, 2019 at 8:45 AM Frans Schneider <fchschneider@REDACTED>

> Hi list,
> According to the docs, the erlang:phash2/2 will return the same result
> regardless of machine architecture and ERTS version. Does this imply
> that this is still true in case the implementation of a basic type, lets
> say a list or map (#{}), will change in the future? Can I assume that
> calculating a hash for a list will have the same result now and in the
> future?

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.

> Thanks
> Frans
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://erlang.org/mailman/listinfo/erlang-questions
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20190828/a73d9f5a/attachment.htm>

More information about the erlang-questions mailing list