s = sha1(random()).hexdigest()

Paul Rubin http
Fri Jan 16 05:47:07 CET 2009


gert <gert.cuykens at gmail.com> writes:
> s = sha1(bytes(random(),'utf-8')).hexdigest()
> i found this, looks let say strange. But it works :)

Be careful, if you're relying on the uniqueness and unpredictability
of this number for program security, that random() isn't designed
for such purposes.  Use os.urandom instead.



More information about the Python-list mailing list