trying to get hash from os.urandom

Grzegorz Smith gregtech at wp.pl
Mon Jan 23 16:13:02 EST 2006


Hi all
I'm writing small python module which will be a password generator. I read
that python can use system random generator on machine whit *nix os. So i
start using os.urandom and when i generate random string i get something
like this:  urandom(8) ->
'\xec2a\xe2\xe2\xeb_\n',"\x9f\\]'\xad|\xe6\xeb",'\xb0\xf8\xd3\xa0>01\xaf'. 
How can I convert this to hash? i change python defaultencoding from ascii
to utf-8 and try convert this to unicode object but I only get:
'\xb4\xa8b\xed\xb9Y-\xf3'
Any help i will appreciated. Does anyone use os.urandom to cryptography?
Gregor



More information about the Python-list mailing list