I am trying to solve following formula:
$(A\ \mathrm{ror}\ 5)\ \mathrm{xor}\ A = X$
where $X$ is an unsigned 32-bit integer which is known, and $A$ is an unsigned 32-bit integer which needs to be calculated. $\mathrm{ror}$ is rotate right through carry.
When replacing $\mathrm{ror}$ with $\mathrm{shr}$ and $\mathrm{shl}$ (Shift right and left and filling with zero bits), I get
$((A\ \mathrm{shr}\ 5)\ \mathrm{or}\ (A\ \mathrm{shl}\ 27))\ \mathrm{xor}\ A = X$
But I can't find a solution for this. Is there some kind of numeric algebra which can be applied to the xor, or, shl, shr operators?
I found a solution how to find valid values of $A$ for a given $X$.
I am not sure if it is actually the procedure described by Hagen von Eitzen.
First I split A into 32 bits $A_0$ to $A_{31}$. Then I set the first bit $A_0 = 0$ (or $1$).
Now I can calculate bit #5, then calculate bit #10, etc.: $A_{(i+5)\ \mathrm{mod}\ 32} = A_i\ \mathrm{xor}\ X_i$.
At the end, the "loop" closes at bit #27 and step #32. Then I need to look if the calculated bit 0 matches the initial value: $A_{27} \stackrel{?}{=} A_{0}\ \mathrm{xor}\ X_{27}$.
If not, then there are zero solutions (this happens in exactly 50% of all values of $X$).
Otherwise, there are always two solutions which are inverted (solution one XOR FFFFFFFF results in solution two, and vice versa). Setting the initial bit to 1 also gives the second solution.