[Tutor] Fun with random numbers

Magnus Lycka magnus@thinkware.se
Wed Jan 22 13:33:01 2003


At 09:42 2003-01-22 -0500, Michael Miller wrote:
>I'm wanting to create a string of random numbers of a given length. I know 
>how
>to generate one number, but getting 5 or 15 or 50 at one time is escaping me.

Do you mean 50 numbers of some given size, of do you mean a number with
50 digits. It's not the same thing... I'm sure you can change my code
from 27 digits to 50 it you wish. Making it into a function that takes
length as a parameter isn't exactly rocket science either...

>I'm messing with some very, excruciatingly trivial "encryption" type things
>mostly just to have something to do.

Encryption is a very tricky subject, and I fear that Python is all
too slow to be really useful for real encrytion. Maybe it would be
more worthwhile to study some of the already existing encryption
libraries for python that are wrappers to C libraries, and to make
some useful application that really uses one of them. I think that's
the practical way to do crypto with Python. See

http://py.vaults.ca/apyllo.py?i=94738404
http://www.post1.com/home/ngps/m2/
http://www.amk.ca/python/code/crypto.html
http://eevolved.com/cryptkit/



-- 
Magnus Lycka, Thinkware AB
Alvans vag 99, SE-907 50 UMEA, SWEDEN
phone: int+46 70 582 80 65, fax: int+46 70 612 80 65
http://www.thinkware.se/  mailto:magnus@thinkware.se