xor incongruences

Michele michele at nectarine.it
Thu Oct 16 16:02:08 EDT 2008


Hi,
I write a simple encoder in python and Java; they do the same
computations, with the same inputs: however they won't produce the same
output.
Let me explain with code.

First of all, you need a test file for input:
$ dd if=/dev/urandom of=test.img bs=1048576 count=1

I have attached the code.
As you can see we have xor-red the same inputs (bitlists are the same,
thus the selected blocks to xor are the same - you can easily see it,
whenever a block is xor-red both programs will print out its hash).
But here comes the strange: the random_block that the
create_random_block function returns is not the same: in Java this block
has an hash which is different from the Python one.
Why?

Thank you
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: test.py
URL: <http://mail.python.org/pipermail/python-list/attachments/20081016/ebd7a9e4/attachment.ksh>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: Test.java
URL: <http://mail.python.org/pipermail/python-list/attachments/20081016/ebd7a9e4/attachment-0001.ksh>


More information about the Python-list mailing list