Hash always use all characters in a long string

Hashes for long strings are computed only when they are used as keys
in a table, not a too common case. And, in that case, it is to easy to
force collisions changing only the characters which are not part of the
hash.
This commit is contained in:
Roberto Ierusalimschy
2020-10-12 10:02:37 -03:00
parent c23cc86c54
commit 9a89fb1c9d
4 changed files with 6 additions and 20 deletions

View File

@@ -76,7 +76,7 @@ static unsigned int luai_makeseed (lua_State *L) {
addbuff(buff, p, &h); /* local variable */
addbuff(buff, p, &lua_newstate); /* public function */
lua_assert(p == sizeof(buff));
return luaS_hash(buff, p, h, 1);
return luaS_hash(buff, p, h);
}
#endif