sections

# Cryptography 101 – – XOR Cipher

#Cryptography #XOR #Cipher

Hello YouTube today we’re going to be talking about XOR ciphers now an interesting thing about these ciphers is a little bit of a departure from what we had talked about before where we were substituting alphabets and letters for each individual one these ciphers require that we use a character encoding

Now the character coding that I’m going to be using is ASCII however this does work with basically every other character encoding because they all essentially do the same thing they turn a character into a series of numbers so if we just look at my name here I’ve

Gone ahead and used the ASCII lookup table to convert these to a binary string of numbers now these numbers are all eight digits long as per the ASCII standard and they all translate into these letters so now what we want to do is we want to do what’s called an

Exclusive or operation on these now what an exclusive or operation is is when you have two numbers you only write a one if each if the bits are exclusively different from each other so that means for this one it’s a one for this one to one for this one because neither of

Those are one it’s a zero and for this because both of them are one this is the exclusive part of exclusive or these are zeros so this is a really basic operation that’s part of a lot of different calculations and computing science but this is the basis of what

Our cipher is so going back to my name here I’ve encoded them with the asking strings the ASCII binary strings so now what we do is we go through and we come up with some sort of key phrase or cipher key so what I’m going to use here

Is I’m just going to use 10 10 10 ten right so eight characters it has to be the exact same length as the message if it’s longer you just cut it off right so now with this what we get is we get 1

1 1 0 1 0 0 1 all right so now we’ve got another 8 character binary string and this encodes to something else it doesn’t matter these characters could actually be outside of what the visible character ranges in an ASCII table so I wouldn’t bother trying to convert these

Into characters when you’re trying to actually send your cypher text if you are using this it’s not that important but what you do know is that this is now different than this and we have done some sort of process to it now this is not a particularly secure cipher and you

Will see that in a minute so now if I go through and I do that to all of the characters in my name I end up with this and what I’ve done is I’ve also gone and look up the ASCII tables and they just happened to be written characters

However there are things like null characters there start of heading start of text end of text and in transmission there’s lots of different characters in the ASCII data set and you could end up with those but just for my name it just happened to end up with these so now if

We want to go ahead and decrypt this what we can do is do the exact same operation with the exact same key 1010 1010 and this is the first character here if we go back can we do that we get 0 1 0 0 0 0

One one now it could go back and look at what we had in our original text this 0 0 1 1 0 0 0 0 0 0 0 0 1 1 1 1 so now we’ve basically converted to and from a ciphertext using just exclusive or operations now these this method of

Encoding and modifying things is actually how a lot of the new versions of encryption work but the problem with doing just this is that if we don’t randomize our passkey every single time what we’ll actually what is actually possible is we know that this is a weird

A character that we had with the little accents on top if we actually take our plain text and our cipher text and we do the exact same operation to them again you’ll see that we get 1010 1010 which is our key so if we’ve successfully managed to get

A plaintext as well as the ciphertext we now have the key which we can go back and decrypt all of our messages with so when we’re doing this sort of encryption what we need to do is we need to make sure that this key is randomized every

Single time and we don’t reuse keys and that’s the end of this particular video if you like my content please like and subscribe and we will see you next time

## Like it? Share with your friends!

hate
0
hate
confused
0
confused
fail
0
fail
fun
0
fun
geeky
0
geeky
love
0
love
lol
0
lol
omg
0
omg
win
0
win

Choose A Format
Poll
Voting to make decisions or determine opinions
Story
Formatted Text with Embeds and Visuals
Video