A
A
Akaero2018-03-15 22:44:45
Algorithms
Akaero, 2018-03-15 22:44:45

Where can XOR be used in practice?

Hello everyone, when solving what problems in programming can
XOR be used?
I found an example about the exchange of values, but it is slower than through the third variable and an example with the simplest encryption.
I would like a more realistic example.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
D3lphi, 2018-03-15
@Akaero

Exclusive or actively used in data encryption. Also, with its help, you can create reliable data storage (RAID 5) in which, if one storage fails, the data will be saved. This can be done by the fact that the xor operation has a property: knowing one operand and the result, we can uniquely determine the second operand.
As for tasks, the task of determining an unpaired element in an array immediately comes to mind.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question