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

gert gert.cuykens at gmail.com
Fri Jan 16 01:21:51 CET 2009


On Jan 16, 1:14 am, gert <gert.cuyk... at gmail.com> wrote:
> from random import random
> from hashlib import sha1
> s = sha1(random()).hexdigest()
>
> TypeError: object supporting the buffer API required,
>
> How does sha1 work in python3.0 please ?

s = sha1(bytes(random(),'utf-8')).hexdigest()

i found this, looks let say strange. But it works :)



More information about the Python-list mailing list