Is this secure?

Michael Rudolf spamfresser at ch3ka.de
Wed Mar 3 10:15:27 EST 2010


Am 03.03.2010 04:51, schrieb Lie Ryan:
> import itertools
> def gen():
>      valid_chars = 'abcdefghijklmnopqrstuvwxyz'
>      for char in itertools.repeat(valid_chars):
>          yield char
>
> gen = gen()
> def gen_rand_string(length):
>      chars = (next(gen) for i in range(length))
>      return ''.join(chars)
>
> since it gives me a perfect distribution of letters,

It does not. Only if not (length(valid_chars) % length)

Regards,
Michael



More information about the Python-list mailing list