> source. The returned data should be unpredictable enough for > cryptographic applications, though its exact quality depends on the > OS implementation.
> >>> from os import urandom > >>> urandom(10) > '[EMAIL PROTECTED]' > >>> > > ??? Its a string of bytes which you can use to encrypt data. The simplest form of reversible encryption is the xor operation. You simply xor the crypto string with the data to get an encrypted string. To return to the data xor the data with the original cryptioo string and you get the original data back. Look at a 4 bit pattern to see this in action: Data = 1010 Crypto = 0010 Data xor Crypto result = 1000 Now apply xor to result: 1000 xor 0010 = 1010, the original data... Of course much more sophiisticated algorithms are used in modern cryptography but the general principle applies, you apply some random stream of crypto key to a set of data and get an encrypted result. You then apply the same set of crypto data (or a set that can reliable be derived from it) to the encrypted stream to retrieve the original data. Examples are DES and RSA. HTH, -- Alan Gauld Author of the Learn to Program web site http://www.freenetpages.co.uk/hp/alan.gauld _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor