Suppose I have 3 bytes, X Y and Z.
X XOR Y results in Z.
I know what X and Z are, but I don't know what Y is, so I'm writing a quick script to figure this out.
Though, I don't know how I would even begin. I did a couple of them by hand and it was simply a matter of comparing each bit one by one, but how can I do this in python? My procedure for solving for Y doesn't seem clear enough.
Since I just need to actually use something like this, it would be enough to either write it or just use something that does this for me.
If x ^ y == z, then x ^ z == y. You can verify this in Python with
>>> X = range(256) # all byte values
>>> Y = range(256)
>>> all(x ^ z == y for x in X for y in Y for z in [x^y])
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With