diff options
author | Guilherme Andrade <[email protected]> | 2017-04-24 22:51:49 +0100 |
---|---|---|
committer | Guilherme Andrade <[email protected]> | 2017-04-24 22:51:49 +0100 |
commit | 3d6b8e7fb68543713f1620a45b8a590ef4ed88a5 (patch) | |
tree | 19aa3c6c0d405bd498671708886919730e5d69c9 /erts/emulator/beam/erl_nif.c | |
parent | da9abd24a93ae8fe174cdd38fc9699bbc45fdf56 (diff) | |
download | otp-3d6b8e7fb68543713f1620a45b8a590ef4ed88a5.tar.gz otp-3d6b8e7fb68543713f1620a45b8a590ef4ed88a5.tar.bz2 otp-3d6b8e7fb68543713f1620a45b8a590ef4ed88a5.zip |
erts: Discontinue salted use of enif_hash/phash2
Diffstat (limited to 'erts/emulator/beam/erl_nif.c')
-rw-r--r-- | erts/emulator/beam/erl_nif.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/erts/emulator/beam/erl_nif.c b/erts/emulator/beam/erl_nif.c index 3ff6c8d3ed..e101747011 100644 --- a/erts/emulator/beam/erl_nif.c +++ b/erts/emulator/beam/erl_nif.c @@ -1220,7 +1220,11 @@ ErlNifUInt64 enif_hash(ErlNifHash type, Eterm term, ErlNifUInt64 salt) case ERL_NIF_INTERNAL_HASH: return make_internal_hash(term, (Uint32) salt); case ERL_NIF_PHASH2: - return make_hash2(term, (Uint32) salt) & ((1 << 27) - 1); + /* It appears that make_hash2 doesn't always react to seasoning + * as well as it should. Therefore, let's make it ignore the salt + * value and declare salted uses of phash2 as unsupported. + */ + return make_hash2(term) & ((1 << 27) - 1); default: return 0; } |