aboutsummaryrefslogtreecommitdiff
path: root/lstate.c
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 /lstate.c
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 '')
-rw-r--r--lstate.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/lstate.c b/lstate.c
index 76df6a20..42274292 100644
--- a/lstate.c
+++ b/lstate.c
@@ -76,7 +76,7 @@ static unsigned int luai_makeseed (lua_State *L) {
76 addbuff(buff, p, &h); /* local variable */ 76 addbuff(buff, p, &h); /* local variable */
77 addbuff(buff, p, &lua_newstate); /* public function */ 77 addbuff(buff, p, &lua_newstate); /* public function */
78 lua_assert(p == sizeof(buff)); 78 lua_assert(p == sizeof(buff));
79 return luaS_hash(buff, p, h, 1); 79 return luaS_hash(buff, p, h);
80} 80}
81 81
82#endif 82#endif