• Managing your videos in Amara teams just got easier! Read about it in our latest blog post. Hide

## ← 01-12 Xor Function Solution

• 1 Follower
• 17 Lines

### Get Embed Code x Embed video Use the following code to embed this video. See our usage guide for more details on embedding. Paste this in your document somewhere (closest to the closing body tag is preferable): ```<script type="text/javascript" src='https://amara.org/embedder-iframe'></script> ``` Paste this inside your HTML body, where you want to include the widget: ```<div class="amara-embed" data-url="http://www.youtube.com/watch?v=vSxIMRE69yM" data-team="udacity"></div> ``` 4 Languages

Showing Revision 1 created 04/24/2012 by Amara Bot.

1. So the answer is always y, and this is why this is such a useful function
2. in cryptography--if we XOR in the value of x twice, they cancel out.
3. So the general property for any value x--x XOR x-- is equal to 0.
4. We can see that from the truth table.
5. The value of x could either be 0--and 0 XOR 0 is 0--or 1, and the value of 1 XOR 1 is 0,
6. and that means that x XOR x is always 0.
7. XOR is also associative and commutative, so that means if we have x XOR y XOR x
8. that's equivalent to x XOR x XOR y which is also equivalent to y.
9. And I've written this using x's and y's--if we change the names of our letters to M and C
10. it becomes really clear why this is useful in cryptography.
11. If we call x the key, then we have the key XOR the message--that's going to be the ciphertext--
12. and then the ciphertext XOR the key again gives us back the message.
13. And what I've described is exactly the One-Time Pad.
14. The key aspect is--why it's called One-Time--is that we can only use the key once.
15. So if we do this one bit at a time, we need a new key for each bit.
16. If we think of doing it for a longer message, well then we need a key long enough
17. that we're XORing each bit with one bit of the key.