Before we talk about the specifics of cryptography,
let’s go over some situations which gave
birth to the field of cryptography.
A famous example you may be familiar with
is the Caesar cipher.
Julius Caesar, a famous leader and general
of the Roman Empire, would often send messages
with sensitive information to his fellow generals,
such as information about an impending attack
from an enemy.
Of course, this information could be misused
if it got into the wrong hands.
What would be the ideal scenario, then?
It’s one in which Caesar sends a message
to his recipient, but only he and the recipient
can read it.
Anyone else trying to understand the information
would fail.
Is there any way to achieve this?
Well, there was term developed in the last
half a millenium to mean precisely this, known
as “encryption,” the process of transforming
information into an unintelligible intermediary
piece of information which can be transformed
back into its original state with decryption.
(This is different from cryptographic hash
functions, as the input is not meant to be
inverted by anyone, after the function is
applied.)
Encryption schemes have two functions in use:
the encryption function, and the decryption
function.
The encryption function will take some meaningful
data and turn it into something illegible.
The decryption function, on the other hand,
will take the illegible information and make
it meaningful.
How can we use this?
Let’s say we have a piece of information,
known as x, which we want to keep secret.
If we encrypt x, it becomes E(x).
Anyone who reads E(x) should not be able to
figure out what the value of x is.
In other words, they do not know the decryption
function.
Let’s say Alice sends E(x) to Bob, and Bob
has the decryption function.
This means that he can run the decryption
function on E(x) to get the original input,
x.
In other words, D(E(x)) should always equal
x.
As long as only trusted third parties have
access to a decryption function, only they
can read the encrypted information.
So how does this relate to Caesar ciphers?
Caesar designed a scheme to perform exactly
this.
A Caesar cipher is meant to be used on text.
As you can see in the image on the right,
each input corresponds to some output letter.
Caeser ciphers rely on what is known as substitution,
meaning that every letter is replaced with
a different one.
Let’s go through the process of how a Caesar
cipher works.
First, a random number is chosen.
This random number represents the amount of
spaces the letter will be shifted.
It is called a “key” because it unlocks
the secret message, making it the secret which
allows someone to figure out the decryption
scheme.
If the key were publicly known, then the Caeser
cipher could be easily broken.
It is said that Caesar used the key 3 for
all his ciphers, as demonstrated in the diagram.
In this section, however, we’ll consider
that any key between 1 and 25 can be chosen.
(Since there are only 26 letters, there’s
no point in choosing anything higher, since
we’d just end up looping around to where
we started.)
Once the key is chosen, we now know how to
algorithmically generate an output from any
given input.
We then take our specific input, run it through
the encryption function which shifts each
letter over some number of times equal to
the key, and spits out the scrambled result.
This encrypted message has no discernable
meaning.
The only use is to be decrypted later.
This encrypted message can be sent to others
safely now, assuming no one else but the recipient
knows how to decrypt the message.
When the recipient receives the message, they
will use the key to recover the meaning from
the previously illegible information.
In this case, decrypting the message requires
shifting every letter in the opposite direction
as the encryption function by the same amount,
the value of the key.
Now, the recipient has the information, but
no one else does.
Voila!
Keep in mind that this scheme does not imply
anything about the integrity of the message
or guarantee of its delivery.
If this message were a note carried by a bird,
there’s nothing to stop someone from shooting
the bird and tearing up the note, or even
changing a few letters during transit.
This means that all we have is the guarantee
that the information will not be read by an
attacker, but they may be able to mutate or
even destroy the message entirely.
Those other guarantees might be secured by
other cryptographic or computer science measures,
but those are out of scope for this lecture.
Let’s consider a scenario in which we might
actually use a Caesar cipher.
Let’s say that, in 69 BCE, Nadir and I are
generals in the Roman army.
He wants to send me a message.
Nadir and I are both good friends with Caesar,
so we’re familiar with his famous encryption
scheme.
As everyone knows, aliens played a big part
in building the cities of Rome.
During their trip, they gave Nadir and myself
a great deal of knowledge about blockchain.
We decide to leverage that during this process.
For whatever reason, he wants to send me the
word “blockchain.”
How can he use the Caesar cipher to protect
his message from foreign eyes?
Some time when Nadir and I met in person,
we decided to use the number 21 as our key,
since Bitcoin has a cap of 21 million bitcoins.
This means that our table would look something
like the image below:
As you’ll see, there are two rows of 26
letters.
In the top row are the letters A through Z
as normal.
In the bottom row, every letter has been shifted
to the right 21 times.
Instead of starting with A, this row instead
starts with F and ends with E. Essentially,
the 1st letter now corresponds to the 6th
letter in the alphabet, the 2nd letter to
the 7th, and so on.
So now that we’ve generated our table, how
can we use it?
Let’s try plugging the word “blockchain”
into the table and see what happens.
The first step is to locate the letter “B”
in the top row of letters.
Once we’ve done that, we can then use the
table to figure out which letter it should
correspond to.
As you can see, it happens to be G.
We go ahead and append that letter to our
new encrypted message.
With the second letter, “L”, we go ahead
and do the same thing.
We locate the letter…
… locate the corresponding letter, “Q”,
…
… and add that to our list.
If we skip ahead to the end, this is what
our final result looks like.
I’m not even going to try to pronounce that
because it makes absolutely no sense.
But that’s exactly what we’re trying to
do!
We want it to make no sense.
Nadir can now send this message to me without
fear of anyone else reading it.
Let’s say Gloria, a traitor general giving
secrets to the enemy, happens to intercept
this message.
What can she do with this message?
She can burn or corrupt it, but she can’t
read it.
Perhaps she doesn’t want to mess with the
message, since that could inform Nadir and
myself of a traitor, so she decides not to
do anything.
By using the Caesar cipher, we’ve foiled
her attempts at betraying the Roman Empire.
I’ve now received the encrypted message.
How can I turn it back into the original message?
As mentioned before, I need to decrypt it
with the decryption function.
In the case of the Caesar cipher, I’d be
using the key to make the function.
Only this time, instead of shifting letters
to the right, I’d shift them to the left.
In other words, I’m undoing the shift that
Nadir did on the original message.
Again, I plug the messages into the table,
and I get the original word, blockchain.
Success!
Nadir and I, as an added layer of obfuscation
outside the Caesar cipher, happen to use blockchain
as a keyword to mean “prepare your defenses,”
meaning that he knows of an impending attack
on my fortress, possibly due to aliens.
I set up my defenses and am safe from the
enemy attack, all thanks to encryption.
The Caesar cipher wasn’t the oldest kind
of cryptography, nor was it the last.
There are several other examples, from ancient
Egypt to modern life.
The Enigma machine, cracked by English hero
and computer scientist Alan Turing, was developed
by the German army during World War II to
make messages indecipherable during transmission.
The machine was possibly the most complex
encryption scheme on the planet at the time.
During World War I and World War II, America
also devised a way to keep messages private.
However, instead of coming up with a code,
they chose to seek help from bilingual Native
Americans from various tribes, known during
the wars as “code talkers.”
Because of the complexity of Native American
languages and scarcity of speakers, they were
asked to serve as communication intermediaries.
A general would safely give a message to a
code talker, and the code talker would translate
then relay the message over a long distance
to another one.
Notice that the translation from English to
the code talker’s language, such as Navajo
or Cherokee, represents the encryption step.
The second code talker would receive the encrypted
message and translate it back to English for
a second general to hear.
To tie this back to cryptography in cryptoeconomics,
you can tell that each of these devices are
used after a decision is made, such as crafting
a message or file for delivery.
Cryptography in all these examples focuses
on securing the decision decided upon by some
entity.
We’ll now go over some of the primitives
in cryptography, which serve as building blocks
for larger devices to accomplish this decision
securing.
