i want to XOR a byte with another byte in a document and then doing XOR of the result obtained with next byte of a document,similarly XORing the whole document.please explain with an example:confused:
Printable View
i want to XOR a byte with another byte in a document and then doing XOR of the result obtained with next byte of a document,similarly XORing the whole document.please explain with an example:confused:
Where are you stuck?
Reading bytes? Using XOR?
Please reply with the code you have so far.
It's pretty basic. That should do what you need.Code:xorValue = initialValue;
while not done
toXor = nextValue( fromSomeplace );
toXor ^= xorValue;
doSomethingWith( toXor );
xorValue = toXor;
Quzah.
What acually does XOR do?
XOR means exclusive OR, where if both of the bits being tested are different, the result is 1, 0 if they're the same :-)
Here is a good text on the subject.Quote:
Originally posted by Munkey01
What acually does XOR do?
Quzah.
When we use the word OR in our daily lives, we usually mean exclusive or (XOR). If you say "I'm gonna rent a movie or go to the cinema" you mean "rent a movie" OR "go to the cinema", not both, which is exactly what XOR is. One or the other, not both.