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

gert gert.cuykens at gmail.com
Thu Jan 15 19:21:51 EST 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