What is Cryptography?
Cryptography is the practice and study of writing and solving codes, or rather, the art of encrypting and decrypting data.
There are different types of cryptographic techniques, but they all essentially revolve around a few key components: a message that is “encrypted”(ciphertext) using a specific algorithm (cipher, or rule-set) for encrypting the data, and a “key” that can be used to decode (“decipher”) the encrypted message into “plaintext”.
FACT: There is no indecipherable encrypted message. This is because computers and humans are deterministic (predictable) and thus so are the algorithms used in encryption. If something has been determined one way, it can always, in theory, be determined the other way given enough time.
Cryptography Simple Examples
A good example of cryptographic devices would be the old decoder ring found in boxes of cereal (like the one in a Christmas Story) or even a crossword puzzle.
Let’s take a simple decoder ring:
- A message that appears as a random group of numbers comes with a decoder ring. This is the cipher text.
- The decoder ring has two sets of symbols on it, one set of numbers and one set of letters. The set of letters can spin to match up with the numbers.
- We are told that if we turn our ring to a given letter / number combination in the message we can use the decoder ring to translate each non-sensical number into a letter to get a message. This is the cipher.
- The letter / number combination we use to translate the letter can be found on the bottom of the message. This is the “key”.
- When we replace each encrypted number with the decrypted letter we get the actual message. This is the plaintext.
Knowing this we can create our own ciphertext that can be deciphered by the decoder ring.
A video showing a decoder ring from Ovaltine from the 1950’s. There are a lot of different styles of rings. The style of ring above was the kind promoted by Captain Midnight and Ovaltine in the 50’s. Other decoder rings may simply have you match up a number with a letter.
Now Let’s take a look at a crossword puzzle:
- With a crossword we get blank boxes which can be read by anyone (we can consider this the encrypted message, ciphertext, in the example).
- The “cipher” in this example is simple; it’s the rules of a crossword (that you will find a word that fits given the hints).
- Then you get a “key” that tells you how to solve the problem (the “hints” that correspond to lines of the crossword)
- If you apply that “key” with enough time and energy and trial and error, you should be able to solve the puzzle.
Here is another example of a simple encrypted message:
- Decode this message “FNNC INA”.
- Here is the rule we used to create the encrypted message “move each letter to the left X spaces alphabetically”
- Here is the key “1”
Now imagine, in the above example, that you have the rule but not the key, you can simply “hack” away until you “crack” the code by starting at zero and trying a selection of numbers. Or imagine you had the key, but didn’t have the rule; you could still “crack” the code given time. Let’s say you just had the message, and not the key or the code, it would still be solvable, but certainly it would take even more time and energy.
This is basic cryptography. Obviously the cryptographic sequences used to secure things like computers, intelligence, and cryptocurrencies (like the Bitcoin) use more complex cryptographic techniques.
The SciShow tackles crypography.
Public Key Cryptography (Asymmetric Cryptography)
Public key cryptography (or asymmetric cryptography) is a popular method of cryptography and the one behind encrypting Bitcoin. The trick is that it uses two “keys” for encryption and decryption rather than one (when you use one it’s called symmetric cryptography).
In public key cryptography, using Bitcoin as an example, we have two “keys”. There is a public key, which can be read by anyone (plaintext) and relates to a transaction. And there is a private key, which is known only to the person who created the transaction (ciphertext), which also relates to the transaction. A basic form of the rule set (cipher) used would be the multiplication of two prime numbers (private key) to get a semiprime (public key).
We can see a simple example of Public-key cryptography using prime and semi-prime numbers below:
- Take any two prime numbers (ex. 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101)
- Multiply those two numbers together. Example: 23 x 73 = 1679
- 1679 would be a “semi-prime” number and your public key.
- The private key would be the two numbers that needed to be multiplied to get the semi-prime 1679. So your private key would be 23 73. To match these two numbers a computer algorithm would try multiplying all the different prime numbers to find the semi-prime public key and checking if each one matched.
- In our example cracking the code is easy, we picked low prime numbers to start so a computer could crack the code quickly. But in cryptocurrencies like Bitcoin, much more complicated algorithms and much larger numbers are used to generate public and private keys.
- Bitcoin adjusts it’s algorithm to be more difficult or simple depending upon how fast the last sequence was deciphered with the goal to have one transaction added to the block chain (ledger of Bitcoin transactions) every 10 minutes.
What is a semi-prime?: A semi-prime number is a natural number that is the product of two, not necessarily distinct, prime numbers.
What are “public and private keys” in cryptography?: A public key is a number that is simple to calculate one way and can be known by anyone, but is attached to another number called a private key. The private key relates to the public key in a difficult to calculate way. Primes and semi-primes work well for creating public and private keys for the purposes of cryptography as they are easy to calculate one way, but not the other naturally. The point is that matching a public key to a private key should take a significant amount of work.
FACT: There are two ways to approach a cryptographic problem: one is to create a computer algorithm that can solve it quickly by increasing CPU and improving the algorithm; the other is to use other methods to find pieces of the puzzle. If, for example, we knew one of the two primes in the subprime example, we could find the solution to the problem much faster.
Why is Cryptography Important?
The principles of cryptography are central to a number of advancements in technology.
The principles of cryptography are the fundamental principles behind communication. Whenever powers – countries, individuals, groups, or web sites – communicate, there is a need to communicate with some level of secrecy. Cryptography was heavily used by Nazi intelligence in WWII. It allowed the allies to break the Nazi’s Enigma machine code helping to win WWII. It drove the technology that created the first digital computer, and is at the heart of almost all computer security, and has been a focal point of intelligence communities around the world since then. Cryptography isn’t just changing the way we handle information and currency; it’s changed and continues to change the future of technology and the world around us constantly.