xor: how come so slow?

Steven D'Aprano steve at REMOVE-THIS-cybersource.com.au
Fri Oct 17 07:36:54 EDT 2008


On Fri, 17 Oct 2008 22:45:19 +1300, Lawrence D'Oliveiro wrote:

> In message <010845d8$0$20638$c3e8da3 at news.astraweb.com>, Steven D'Aprano
> wrote:
> 
>> On Fri, 17 Oct 2008 20:51:37 +1300, Lawrence D'Oliveiro wrote:
>> 
>>> ... why do you say that xoring random data with other random data
>> produces less randomness than you started with?
> 
> blocksize <= number_of_blocks * blocksize

I must be thick, because that looks like a non sequitor to me. I don't 
see the relevance.

Of course, that's just another way of saying that:

1 <= number_of_blocks

and I don't see how this relates to whether xoring random data with other 
random data decreases the randomness available.

>>> c1 = os.urandom(1)
>>> c2 = os.urandom(1)
>>> c3 = chr( ord(c1)^ord(c2) )

Is it your contention that c3 is more predictable than c1 or c2? If so, 
why?



-- 
Steven



More information about the Python-list mailing list