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

@@ -523,7 +523,6 @@ static lu_mem checkgraylist (global_State *g, GCObject *o) {
((void)g); /* better to keep it available if we need to print an object */
while (o) {
lua_assert(!!isgray(o) ^ (getage(o) == G_TOUCHED2));
//lua_assert(isgray(o) || getage(o) == G_TOUCHED2);
lua_assert(!testbit(o->marked, TESTBIT));
if (keepinvariant(g))
l_setbit(o->marked, TESTBIT); /* mark that object is in a gray list */