[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: what is the role of the `seed` field in the Lua global state?
- From: 云风 Cloud Wu <cloudwu@...>
- Date: Thu, 12 Mar 2020 13:19:27 +0800
Roberto Ierusalimschy <roberto@inf.puc-rio.br> 于2020年3月11日周三 下午8:57写道:
>
> > > What does this seed accomplish? What problem does it solve?
> > >
> >
> > I suspect it is related to this:
> > https://stackoverflow.com/questions/9241230/what-is-murmurhash3-seed-parameter/9241429#9241429
> >
> > attackers may use the properties of a hash function to construct a denial
> > > of service attack. They could do this by providing strings to your hash
> > > function that all hash to the same value destroying the performance of your
> > > hash table. But if you use a different seed for each run of your program,
> > > the set of strings the attackers must use changes.
>
> Exactly.
>
> -- Roberto
>
Is there any way to specify a seed when I create a new lua VM ? It's
very useful for reproduction of bugs .
If the seed is always random, the order of table iteration would be
different every time.
I wish you can add a new api to create a lua VM with a seed in future.
--
http://blog.codingnow.com