Testing BitXOR (OpenInsight 32-Bit)
At 30 APR 2002 02:13:29PM Donald Bakke wrote:
I am testing an algorithm that uses BitXOR. I know that BitXOR works, but what I really need to know is how to reverse it. That is, I know what the result after applying BitXOR is supposed to look like but I am trying to locate within a string the original value. How do I determine that?
Much appreciated,
dbakke@srpcs.com
At 30 APR 2002 02:29PM Bob Carten wrote:
Don
How about if you bitAnd the result, then bitNot that result?
a=110
b=101
c=bitXor(a,b) ; *=010
d=bitAnd(c,a) ; *=001
e=bitNot(d) ; *=110 == a
Only tried on paper, not tested for real
Bob
At 30 APR 2002 07:34PM Donald Bakke wrote:
Bob,
How about if you bitAnd the result, then bitNot that result? a=110 b=101 c=bitXor(a,b) ; *=010 d=bitAnd(c,a) ; *=001 e=bitNot(d) ; *=110 == a
I think the problem with the above is that it assumes I already know the value of 'a' when 'a' is the value I'm trying to figure out. I know 'b' and I know 'c'. Did you mistype 'a' in your BitAnd function or was this an oversight?
Thanks,
dbakke@srpcs.com
At 01 MAY 2002 12:44PM Jim Weir wrote:
Donald:
How about this:
a=110
b=101
c=BITXOR(a,b)=011
a=BITXOR(b,c)=BITXOR(101,011)=110
b=BITXOR(a,c)=BITXOR(110,011)=101
cheers,
jim
At 03 MAY 2002 03:08AM Donald Bakke wrote:
Jim,
That works! Thank you.
dbakke@srpcs.com