aboutsummaryrefslogtreecommitdiff
path: root/lstring.h
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2020-10-12 10:02:37 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2020-10-12 12:29:09 -0300
commit9a89fb1c9dfeda4640780111f9e9437f08cfad88 (patch)
tree63b47c65d3881929d45fe63156816157356920a6 /lstring.h
parentc23cc86c542449db47bdb21e9550203309bef045 (diff)
downloadlua-9a89fb1c9dfeda4640780111f9e9437f08cfad88.tar.gz
lua-9a89fb1c9dfeda4640780111f9e9437f08cfad88.tar.bz2
lua-9a89fb1c9dfeda4640780111f9e9437f08cfad88.zip
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.
Diffstat (limited to 'lstring.h')
-rw-r--r--lstring.h3
1 files changed, 1 insertions, 2 deletions
diff --git a/lstring.h b/lstring.h
index a413a9d3..450c2390 100644
--- a/lstring.h
+++ b/lstring.h
@@ -41,8 +41,7 @@
41#define eqshrstr(a,b) check_exp((a)->tt == LUA_VSHRSTR, (a) == (b)) 41#define eqshrstr(a,b) check_exp((a)->tt == LUA_VSHRSTR, (a) == (b))
42 42
43 43
44LUAI_FUNC unsigned int luaS_hash (const char *str, size_t l, 44LUAI_FUNC unsigned int luaS_hash (const char *str, size_t l, unsigned int seed);
45 unsigned int seed, size_t step);
46LUAI_FUNC unsigned int luaS_hashlongstr (TString *ts); 45LUAI_FUNC unsigned int luaS_hashlongstr (TString *ts);
47LUAI_FUNC int luaS_eqlngstr (TString *a, TString *b); 46LUAI_FUNC int luaS_eqlngstr (TString *a, TString *b);
48LUAI_FUNC void luaS_resize (lua_State *L, int newsize); 47LUAI_FUNC void luaS_resize (lua_State *L, int newsize);