Most people expect discussions of cryptography, like other forms of higher mathematics, to end with a lot of drooling and eye glazing. While the expectation is understandable, it is also unfortunate because some of what goes on can be understood by a lot people before any glazing hits the eyeball and any drool escapes the lips.

There are three general types of cryptographic systems: symmetric, asymmetric, and hashing. Symmetric cryptographic systems use the same key for encoding and decoding messages. Asymmetric systems use one key to encode and another mathematically related key to decode. Hashing runs the original text through an algorithm to produce some type of number or letter string. This string or hash can then be used to compare files over time to see if any changes have been made. Host-based intrusion detection systems use hashes to see if hackers have changed important system files on a computer.

The algorithms themselves involve a lot of mathematics, which, as we know, is where the eyes glazing over thing happens so I won’t discuss that. But after a key is generated, it is applied to the test to be encrypted. How does that happen, the actual creation of cyphertext?

Through a binary operation called exclusive or or XOR. You’ll be scanning the numbers below just like an addition problem, but instead of adding we will write down a “1” when two digits being compared are different and a “0” when they are the same. Here’s how it works:

The original text is in binary 0110111010010001

The key is in binary as well1010001111000101

Our cyphertext 1100110101010100

We compare the first digit on the left of the top string of numbers, in this case “0”, with the first digit on the key, “1”. 0 and 1 are different, so we write down “1”. This is the first digit of our encoded text, or cyphertext. Next digit from the top line is “1”, from the key “0”, they’re different so we write “1”. Third digit from the top line, “1”, from the key “1”, they match so we write down “0” in the cyphertext. The fourth on top is a “0”, fourth in the key is “0”, they match, so we write down “0” in the cyphertext. Keep doing this to the rest of the text and you get “1100110101010100”. This is our complete cyphertext and this is what we’ll be transmitting on the wire or writing to disk. If someone comes along and intercepts this string, so long as they don’t know the original text or the key, they will not be able to decipher it.

Let’s do it again, this time with a different key and different original text:

New original text 0110011010011000

New key1010101111001100

New cyphertext 1100110101010100

Notice here that while the new original text is different from our first example, and the key is different as well, the encoded cyphertext is the same as the original. Someone listening in on our network would get two strings which were totally the same strings, but since they did not have either key, they would not be able to determine what was actually being said.

Encryption standards don’t necessarily apply the XOR function exactly like we did here. The actual processes involved are a bit more complicated, but this is a good introduction to the basics. It’s not something you’re going to see on an A+, Network+, or even Security+ exam, but I teach it to help remove some of the mystery that surrounds cryptography.

## Comments

You can follow this conversation by subscribing to the comment feed for this post.