[Tutor] os.urandom()

Alan Gauld alan.gauld at btinternet.com
Sun Aug 8 02:00:30 CEST 2010


"Richard D. Moores" <rdmoores at gmail.com> wrote

> Yes, the number of bytes seems to <= 6, or is it?:
>>>> os.urandom(6)
> b'\xf1\x1c\x15\x83\x14\x0e'

ok

>>>> os.urandom(6)
> b'l\xbb\xae\xb7\x0ft'

still ok - the l and t at the ends are valid characters so Python
prints the letter

>>>> os.urandom(6)
> b'\x1f\x00~\xfbz\x98'

Same here with the ~ and z characters

>>>> os.urandom(6)
> b'\x98\xd2\xb2\xaa\x9bv'

and the (second) a and v

>>>> os.urandom(6)
> b'2\x07\x81v\n-'

and the 2, v and -  Also notice the eol character in there(\n)

Hopefully you get the picture?

> Alan, are you using Windows, as I am?

Yes. XP.

> website-permitted, but stronger passwords could be generated with 
> the
> use of os.urandom(). At this point, I think not.

You probably could but it would take a lot of work for very little 
benefit.

HTH,


-- 
Alan Gauld
Author of the Learn to Program web site
http://www.alan-g.me.uk/




More information about the Tutor mailing list