Hey friends! @lemony-cricket here, and even though cryptography is the stuff that powers our collective rocket lambo ride to the moon... encryption has absolutely nothing to do with that. That's it. End of post. You can stop reading now.
This is the first post in this series. The next post is here.
But I want to understand... please teach me.
Fair enough. In this series (of which this is the inaugural post), I will attempt to teach the beginner about the basic building blocks of cryptography. Note that this series is not about cryptocurrency, but about the field of computer and information science known as cryptography. But despair not, dear reader, because learning about cryptography now will actually help you understand better how cryptocurrency works, if that's your thing! I will probably do a series on that too, after this one.
We are starting from the ground up here. I'll stress beginner again. If you cringed at the title, knowing full well what a Caesar cipher is and wondering why it's being mentioned in this millenium, you might get a little bored with this post. If so, come back in a few posts when we should be getting into more modern encryption.
The Caesar Cipher
a brief introduction to the concept of encryption
The first occurrences of what we today call 𝕖𝕟𝕔𝕣𝕪𝕡𝕥𝕚𝕠𝕟d1 utilised the group of 𝕒𝕝𝕘𝕠𝕣𝕚𝕥𝕙𝕞𝕤d2 we now know as classical ciphers. There are a few different types of classical ciphers, all of which are no longer useful in the Information Age. They do, however, provide an interesting bit of history, as well as an easy way to exemplify the concept of encryption.
The most famous classical cipher is most likely the Caesar cipher, which you might have guessed was used by the Roman dictator Julius Caesar. Also known as the shift cipher, this algorithm is extremely simple and can be performed using only a pencil and paper (or even your favourite word processor!).
The shift cipher worked much better when nobody really knew what it was. It's distant history today. But what I would like to do, is use is as an example to introduce some words and concepts you'll need to know for future installments.
Now, together, let's encrypt a message, by hand, using the shift cipher.
You should have paper and something to write with for this portion.
First, let's write down the English alphabet. Write it in a straight line, like shown below:
A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
Next, pick a number from 1 to 23. This number will be your 𝕜𝕖𝕪d3. As an example, I'm going to use a 𝕣𝕠𝕥𝟙𝟛d4 cipher, which means my key is 13. Starting with
A as zero, count forward in the alphabet to your key, and write
A beneath the letter you end up on:
0 1 2 3 4 5 6 7 8 9 0 1 2 3 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z A
Now fill in the rest of the alphabet. When you get to the end, wrap around to below the
A and keep going. Be sure to keep the letters lined up neatly! Leave some space between them or draw lines between the columns to distinguish them.
A B C D E F G H I J K L M N O P Q R S T U V W X Y Z N O P Q R S T U V W X Y Z A B C D E F G H I J K L M
Write a message down on the paper. It should consist only of the 26 letters above, no punctuation. This message is your 𝕡𝕝𝕒𝕚𝕟𝕥𝕖𝕩𝕥d4. Here's an example:
I WANT A RUSTY AXE
For each letter in your plaintext, find that letter on the top line above, and write down the letter directly beneath it. For instance, for
I we would write
W we would write
J, and so on:
V JNAG N EHFGL NKR
We did it! What I have just done, and what you've done too if you've been following along, is technically encryption (albeit a very unsafe variety!).
Now, we can prove it worked by reversing the process: find each letter of the 𝕔𝕚𝕡𝕙𝕖𝕣𝕥𝕖𝕩𝕥d5 in the bottom row and replace it with the letter immediately above it. You should end up with the original message again:
I WANT A RUSTY AXE
At this point, you've not only done encryption, but you've performed a 𝕕𝕖𝕔𝕣𝕪𝕡𝕥𝕚𝕠𝕟d6 operation as well! We're on a roll!
Here's your chance for an upvote if you're paying attention. Think of a short message you'd like to give me. Pick your own key and message; don't use mine! Then encrypt it with a shift cipher using the steps above, and send your ciphertext in the comments. I like a challenge, so don't tell me what the key is! 🍋
From my personal knowledge and experience unless otherwise noted.
- encryption: the act of transforming data in a reversible way in order to hide information from others.
- algorithm: a specific process with a strict set of rules which, when applied, generates some desired result. There are algorithms for every kind of problem a computer can solve. A cipher is a type of algorithm, used for encryption.
- key: a secret that is used along with the cipher algorithm. In general, algorithms do not change, but keys do. The "13" part of the rot13 example above is the key.
- rot13: a specific Caesar cipher using a shift of 13, so that the encrypt and decrypt operations are functionally the same algorithm with the standard English alphabet (since 13 is half of 26).
- plaintext: the actual message or data; this is the thing you are trying to hide by encrypting.
- ciphertext: the encrypted message or data; the output of the cipher. If your cipher is secure (shift ciphers are not secure!), this is what is safe to send over the Internet, store in public places, etc.