Rerversing AND Bitwise.
Posted
by Benjamin
on Stack Overflow
See other posts from Stack Overflow
or by Benjamin
Published on 2010-04-10T08:52:56Z
Indexed on
2010/04/10
9:03 UTC
Read the original article
Hit count: 294
Hey all,
Here's the following algorithm:
int encryption(int a, int b) {
short int c, c2;
uint8_t d;
c = a ^ b;
c2 = c;
d = 0;
while(c) {
c &= c - 1;
d++;
}
return d;
}
How can I find which variable a and b I should send in that function to decide of the output value of d?
In other words, how can I reverse the algoritm to let's say if I want d=11?
© Stack Overflow or respective owner