wich trascendentl is?
Posted on 2005-02-21 10:25:10 by rea
I don't think it is transcendental, MathWorld says it would have to have t ranscendental functions in it. I don't think XOR is trancendental.

Actuall MathWorld has some interesting info on XOR as well.
Posted on 2005-02-21 11:14:15 by Eóin
I assumed A, B, C and the result are some number of bits in length - which I've seen represented by:

( A[0:n] + B[0:n] ) XOR C[0:n] = D[0:n]

If you write a program to test all the possible values for A, B and C while comparing the result to:

A[0:n] XOR B[0:n] XOR C[0:n] = E[0:n]

...then we get the following results:
``````bits D==E    D!=E     Total
---  ----    ----    -------
1       8        0        8
2      48       16       64
3     288      224      512
4    1728     2368     4096
5   10368    22400    32768
6   62208   199936   262144
7  373248  1723904  2097152
8 2239488 14537728 16777216``````
Sorry, I made the mistake of only checking the one and two bit versions - we can see how different they become as the number of bits increase. This increase is due to carry propagation within the addition.
Posted on 2005-02-21 20:18:17 by bitRAKE
xor_eax,

the problem, generally speaking, is very interesting...

I started a vaguely related thread on it, see http://community.reverse-engineering.net/viewtopic.php?t=4017

The only approach I am aware of, at the moment, is bruteforcing it.
But first you may state the correct priority of the operators. Next we need some semplification.

Assuming we are dealing with bytes (first simplification), and C1=A+B (second simplification), we have two cases:

(1)
'+' prioritary than XOR (as in C language): we have
C1^(C2-C3)^C1 = C4
this is trivial, because C1^C1=0, X^0=X, so
C2-C3=C4
the equation holds for every value of C1!

(2)
XOR prioritary than '+': we have
((C1^C2)-C3)^C1 = C4
if you code a simple bruteforcer, you will find that it holds for a giant number of C1 values

``````
#include <stdio.h>

void
main(void)
{
int i, j, k, l;
unsigned char c1, c2, c3, c4;

for (i=0; i<256; i++) for (j=0; j<256; j++)
for (k=0; k<256; k++) for (l=0; l<256; l++) {
c1 = (unsigned char)i;
c2 = (unsigned char)j;
c3 = (unsigned char)k;
c4 = (unsigned char)l;
if ((((c1 ^ c2) - c3) ^ c1) == c4)
printf("found c1=%x c2=%x c3=%x c4=%x\n", c1, c2, c3, c4);
}
}
``````

Regards, bilbo
Posted on 2005-02-22 04:37:58 by bilbo