I would like to ask: with A
, B
, and C
are any binary number. After getting C = A & B
(&
is AND
operator), is there any possibility to recover A
from B
and C
?
I know that the information of A
will be lost through the operation. Can we form a function like B <...> C = A
, and how complexity it can be?
For example:
A = 0011 B = 1010 C = A & B = 0010
The 2nd bit of C
is 1
, i.e. 2nd bit of A
and B
must be 1
. However, the other bits lack information to be recovered.
Thank you in advance.
You can't recover A
, but you can write A = (X & ~B) ^ C
. Here, X
can be anything (and it gives all the A
's).
Of course this will work only for B
and C
such that C & ~B == 0
.
This is a parametrized solution. Example in python
>>> A = 32776466
>>> B = 89773888
>>> C = A & B
>>> C
22020352
>>> X = 1234567890 # arbitrary value
>>> U = (X & ~B) ^ C
>>> U
1238761874
>>> U & B # same result as A & B
22020352