[python3.0] s = sha1(random()).hexdigest()

Paul Rubin http
Thu Jan 15 19:20:41 EST 2009


gert <gert.cuykens at gmail.com> writes:
> s = sha1(random()).hexdigest()
> 
> TypeError: object supporting the buffer API required,
> 
> How does sha1 work in python3.0 please ?

sha1 hashes strings, not numbers.  Try using str(random()).  But if
you want some random hex digits, try os.urandom(10).encode('hex')
rather than messing with sha1.



More information about the Python-list mailing list