lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


> Strings have a similar problem if the 'step' parameter of luaS_hash is
> > 1, you can create enormous amounts of strings that all hash to the
> same value. This works for strings of length 41 and up in Lua 5.4.
> Inserting a million maliciously crafted strings into the key position
> of a table takes close to two hours on my laptop.

We (the Lua team) were talking exactly about that. According to [1],
the goal of adding long strings in Lua was exactly to allow all string
hashes to use all characters. That was done (commit a4b96ce9), but for
some reason it was undone two months later (commit cfbe2333a).

[1] http://lua-users.org/lists/lua-l/2012-01/msg00196.html

-- Roberto