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

Paul Rubin http
Thu Jan 15 23:47:07 EST 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