❔ Reversing XOR of shifted numbers
Hello! I have 2 binary numbers:
A= 10111
B= 11110
B is A shifted left by 2 positions
C is ( A XOR B )
C= 01001
Is it possible to find out A and B by only knowing C ?
11 Replies
B is not A shifted left by 2
Ero#1111
REPL Result: Success
Result: string
Compile: 416.632ms | Execution: 22.782ms | React with ❌ to remove this embed.
I'm not too deep in this topic, but I'd say no. Especially if you have a leading 0 like C has.
So, to give more context, here is the function that does the shifting, it is in C
The original values are in hexa and I tried to make it as simple as possible but as it turns out I might not understand it completely. Sorry for that.
So a hex number is passed through this function, and the result is XOR-ed with the original number. Will the XOR result be enough to find out the original hex number?
I can also post the entire program if you think it helps.
I mean, what you can do is
A XOR B = C
C XOR A = B
C XOR B = A
But you cannot create A and B from C out of thin air
I understand. I was hoping that knowing the relation between A and B ( B is A shifted) would open the possibility of finding them
Yes, there's a 1:1 mapping between
A
and A^(A<<2)
assuming this is shifting and not rotating.ChucklesTheBeard#6079
REPL Result: Success
Console Output
Compile: 635.129ms | Execution: 51.054ms | React with ❌ to remove this embed.
So could this be used to find A and B?
Yep, 1:1 mappings are reversible.
Was this issue resolved? If so, run
/close
- otherwise I will mark this as stale and this post will be archived until there is new activity.