lua-users home
lua-l archive

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

That's not the best solution. Only a temporary palliative that
probably does not even solve any practical problem.

Really there should be a non-global seed that can be set on separate
generators. This global seed can only be used to instantiate a new
generator (and then in Lua you can provide a better generator scheme:
the current implementation is fast, but very poor, with insufficient
insufficient for security as its hashing function is very easily
attackable, too much predictable, and does not use enough bits for its
internal state).

And from which data will you use the lua_changeseed() ? You need
access to some other entropy source if you intend to use it for
security purposes; all that can be used with it is to build
reproductible test cases with common sequences of numbers from the
PRNG, from a known constant seed used for testing purpose only (e.g.
coverage test units).

Le mer. 25 mars 2020 à 11:38, 云风 Cloud Wu <> a écrit :
> Coda Highland <> 于2020年3月12日周四 下午11:58写道:
> >
> > If you're already patching the VM, it shouldn't be hard to just patch the seed assignment yourself.
> >
> I found that we don't even have to patch the VM  :)
> I wrote a small function `lua_changeseed(lua_State *L, unsigned int
> seed);`  to change the seed.
> --