From 7288528a1e081d101a1bc19346a974088b6b8315 Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Wed, 1 Apr 2020 10:52:41 -0300 Subject: Short strings always use all bytes in the hash Collisions in short strings occurr just by their existence, when internalizing them. (Collisions in long strings is caused/controlled by the program, when adding them as keys to the same table.) --- lstring.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'lstring.h') diff --git a/lstring.h b/lstring.h index c23d6874..56896867 100644 --- a/lstring.h +++ b/lstring.h @@ -37,7 +37,8 @@ #define eqshrstr(a,b) check_exp((a)->tt == LUA_VSHRSTR, (a) == (b)) -LUAI_FUNC unsigned int luaS_hash (const char *str, size_t l, unsigned int seed); +LUAI_FUNC unsigned int luaS_hash (const char *str, size_t l, + unsigned int seed, size_t step); LUAI_FUNC unsigned int luaS_hashlongstr (TString *ts); LUAI_FUNC int luaS_eqlngstr (TString *a, TString *b); LUAI_FUNC void luaS_resize (lua_State *L, int newsize); -- cgit v1.2.3-55-g6feb