# Overview of cryptography

# What is Cryptography? A Complete Overview

Contents

- 1 What is Cryptography? A Complete Overview
- 1.1 5. Introduction to Cryptography
- 1.2 5.2. Brief History of Cryptography
- 1.3 5.3. Definitions
- 1.4 5.4. Definitions: Alice, Bob, Eve, and Mallory
- 1.5 5.5. Definitions: Keys
- 1.6 5.6. Definitions: Confidentiality, Integrity, Authenticity
- 1.7 5.7: Overview of schemes
- 1.8 5.8. Definitions: Kerckhoff’s Principle
- 1.9 5.9. Definitions: Threat models
- 1.10 What is Cryptography? A Complete Overview
- 1.11 �� What is cryptography?
- 1.12 �� Principles of cryptography
- 1.13 �� Guidelines for cryptographers
- 1.14 �� What practical problems does cryptography solve?
- 1.15 �� Types of cryptography
- 1.16 �� Cryptology vs cryptography vs cryptanalysis
- 1.17 �� What is quantum computing, and will quantum computing break cryptography?
- 1.18 �� How do Bitcoin, cryptocurrency and other blockchains utilize cryptography?
- 1.19 �� History of cryptography – A timeline of important events
- 1.20 �� For further study
- 1.21 Cryptography Explained
- 1.22 Practical Everyday Applications
- 1.23 Algorithms – Transforming Data
- 1.24 Authentication with Public Keys
- 1.25 Practical Uses of Asymmetric Crypto
- 1.26 Integrity Protection
- 1.27 Practical Uses of Hash Algorithms
- 1.28 Practical Uses of Symmetric Ciphers
- 1.29 Cryptographic Keys and Key Management

If you’re interested in reading more in-depth about how Bitcoin works, you can do so on bitcoin.org.

## 5. Introduction to Cryptography

In this class, we will teach you the basic building blocks of cryptography, and in particular, just enough to get a feeling for how they work at a conceptual level. Understanding cryptography at a conceptual level will give you good intuition for how industrial systems use cryptography in practice. However, cryptography in practice is very tricky to get right. Actual real-world cryptographic implementations require great attention to detail and have hundreds of possible pitfalls. For example, private information might leak out through various side-channels, random number generators might go wrong, and cryptographic primitives might lose all security if you use them the wrong way. We won’t have time to teach all of those details and pitfalls to you in CS 161, so you should never implement your own cryptography using the algorithms we teach you in this class. Instead, the cryptography we show you in this class is as much about educating you as a consumer as educating you as an engineer. If you find yourself needing an encrypted connection between two computers, or if you need to send an encrypted message to another person, you should use existing well-vetted cryptographic tools. However, you will often be faced with the problem of understanding how something is supposed to work. You might also be asked to evaluate the difference between alternatives. For that, you will need to understand the underlying cryptographic engineering involved. Similarly, there are sometimes applications that take advantage of cryptographic primitives in non-cryptographic ways, so it is useful to know the primitives. You never know when you might need a hash, an HMAC, or a block cipher for a non-security task that takes advantage of their randomness properties. In summary, know that we’re going to teach you just enough cryptography to be dangerous, but not enough to implement industrial-strength cryptography in practice.

## 5.2. Brief History of Cryptography

The word “cryptography” comes from the Latin roots *crypt*, meaning secret, and *graphia*, meaning writing. So cryptography is quite literally the study of how to write secret messages. Schemes for sending secret messages go back to antiquity. 2,000 years ago, Julius Caesar employed what’s today referred to as the “Caesar cypher,” which consists of permuting the alphabet by shifting each letter forward by a fixed amount. For example, if Caesar used a shift by \(3\) then the message “cryptography” would be encoded as “fubswrjudskb”. With the development of the telegraph (electronic communication) during the 1800s, the need for encryption in military and diplomatic communications became particularly important. The codes used during this “pen and ink” period were relatively simple since messages had to be decoded by hand. The codes were also not very secure, by modern standards. The second phase of cryptography, the “mechanical era,” was the result of a German project to create a mechanical device for encrypting messages in an unbreakable code. The resulting *Enigma* machine was a remarkable feat of engineering. Even more remarkable was the massive British effort during World War II to break the code. The British success in breaking the Enigma code helped influence the course of the war, shortening it by about a year, according to most experts. There were three important factors in the breaking of the Enigma code. First, the British managed to obtain a replica of a working Enigma machine from Poland, which had cracked a simpler version of the code. Second, the Allies drew upon a great deal of brainpower, first with the Poles, who employed a large contingent of mathematicians to crack the structure, and then from the British, whose project included Alan Turing, one of the founding fathers of computer science. The third factor was the sheer scale of the code-breaking effort. The Germans figured that the Enigma was well-nigh uncrackable, but what they didn’t figure on was the unprecedented level of commitment the British poured into breaking it, once codebreakers made enough initial progress to show the potential for success. At its peak, the British codebreaking organization employed over 10,000 people, a level of effort that vastly exceeded anything the Germans had anticipated. They also developed electromechanical systems that could, in parallel, search an incredible number of possible keys until the right one was found. Modern cryptography is distinguished by its reliance on mathematics and electronic computers. It has its early roots in the work of Claude Shannon following World War II. The analysis of the *one-time pad* (discussed in the next chapter) is due to Shannon. The early 1970s saw the introduction of a standardized cryptosystem, DES, by the National Institute for Standards in Technology (NIST). DES answered the growing need for digital encryption standards in banking and other businesses. The decade starting in the late 1970s then saw an explosion of work on a computational theory of cryptography.

## 5.3. Definitions

Intuitively, we can see that the Caesar cypher is not secure (try all 26 possible shifts and you’ll get the original message back), but how can we prove that it is, in fact, insecure? To formally study cryptography, we will have to define a mathematically rigorous framework that lets us analyze the security of various cryptographic schemes. The rest of this section defines some important terms that will appear throughout the unit.

## 5.4. Definitions: Alice, Bob, Eve, and Mallory

The most basic problem in cryptography is one of ensuring the security of communications across an insecure medium. Two recurring members of the cast of characters in cryptography are *Alice* and *Bob*, who wish to communicate securely as though they were in the same room or were provided with a dedicated, untappable line. However, they only have available a telephone line or an Internet connection subject to tapping by an eavesdropping adversary, *Eve*. In some settings, Eve may be replaced by an active adversary *Mallory*, who can tamper with communications in addition to eavesdropping on them. The goal is to design a scheme for scrambling the messages between Alice and Bob in such a way that Eve has no clue about the contents of their exchange, and Mallory is unable to tamper with the contents of their exchange without being detected. In other words, we wish to simulate the ideal communication channel using only the available insecure channel.

## 5.5. Definitions: Keys

The most basic building block of any cryptographic system (or *cryptosystem*) is the *key*. The key is a secret value that helps us secure messages. Many cryptographic algorithms and functions require a key as input to lock or unlock some secret value. There are two main key models in modern cryptography. In the *symmetric key* model, Alice and Bob both know the value of a secret key, and must secure their communications using this shared secret value. In the *asymmetric key* model, each person has a secret key and a corresponding *public key*. You might remember RSA encryption from CS 70, which is an asymmetric-key encryption scheme.

## 5.6. Definitions: Confidentiality, Integrity, Authenticity

In cryptography, there are three main security properties that we want to achieve. *Confidentiality* is the property that prevents adversaries from reading our private data. If a message is confidential, then an attacker does not know its contents. You can think about confidentiality like locking and unlocking a message in a lockbox. Alice uses a key to lock the message in a box and then sends the message (in the locked box) over the insecure channel to Bob. Eve can see the locked box, but cannot access the message inside since she does not have a key to open the box. When Bob receives the box, he is able to unlock it using the key and retrieve the message. Most cryptographic algorithms that guarantee confidentiality work as follows: Alice uses a key to *encrypt* a message by changing it into a scrambled form that the attacker cannot read. She then sends this encrypted message over the insecure channel to Bob. When Bob receives the encrypted message, he uses the key to *decrypt* the message by changing it back into its original form. We sometimes call the message *plaintext* when it is unencrypted and *ciphertext* when it is encrypted. Even if the attacker can see the encrypted ciphertext, they should not be able to decrypt it back into the corresponding plaintext–only the intended recipient, Bob, should be able to decrypt the message. *Integrity* is the property that prevents adversaries from tampering with our private data. If a message has integrity, then an attacker cannot change its contents without being detected. *Authenticity* is the property that lets us determine who created a given message. If a message has authenticity, then we can be sure that the message was written by the person who claims to have written it. You might be thinking that authenticity and integrity seem very closely related, and you would be correct; it makes sense that before you can prove that a message came from a particular person, you first have to prove that the message was not changed. In other words, before you can prove authenticity, you first have to be able to prove integrity. However, these are not identical properties and we will take a look at some edge cases as we delve further into the cryptographic unit. You can think about cryptographic algorithms that ensure integrity and authenticity as adding a seal on the message that is being sent. Alice uses the key to add a special seal, like a piece of tape on the envelope, on the message. She then sends the sealed message over the unsecure channel. If Mallory tampers with the message, she will break the tape on the envelope, and therefore break the seal. Without the key, Mallory cannot create her own seal. When Bob receives the message, he checks that the seal is untampered before unsealing the envelope and revealing the message. Most cryptographic algorithms that guarantee integrity and authenticity work as follows: Alice generates a *tag* or a *signature* on a message. She sends the message with the tag to Bob. When Bob receives the message and the tag, he verifies that the tag is valid for the message that was sent. If the attacker modifies the message, the tag should no longer be valid, and Bob’s verification will fail. This will let Bob detect if the message has been altered and is no longer the original message from Alice. The attacker should not be able to generate valid tags for their malicious messages. A related property that we may want our cryptosystem to have is *deniability*. If Alice and Bob communicate securely, Alice might want to publish a message from Bob and show it to a judge, claiming that it came from Bob. If the cryptosystem has deniability, there is no cryptographic proof available to guarantee that Alice’s published message came from Bob. For example, consider a case where Alice and Bob use the same key to generate a signature on a message, and Alice publishes a message with a valid signature. Then the judge cannot be sure that the message came from Bob–the signature could have plausibly been created by Alice.

## 5.7: Overview of schemes

We will look at cryptographic primitives that provide confidentiality, integrity, and authentication in both the symmetric-key and asymmetric-key settings.

Symmetric-key | Asymmetric-key | |
---|---|---|

Confidentiality | Block ciphers with chaining modes (e.g., AES-CBC) | Public-key encryption(e.g., El Gamal, RSA encryption) |

Integrity and authentication | MACs (e.g., AES-CBC-MAC) | Digital signatures (e.g., RSA signatures) |

*Cryptographic hashes*provide a one way digest: They enable someone to condense a long message into a short sequence of what appear to be random bits. Cryptographic hashes are irreversible, so you can’t go from the resulting hash back to the original message but you can quickly verify that a message has a given hash.- Many cryptographic systems and problems need a lot of random bits. To generate these we use a
*pseudo random number generator*, a process which takes a small amount of true randomness and stretches it into a long sequence that should be indistinguishable from actual random data. *Key exchange*schemes (e.g. Diffie-Hellman key exchange) allow Alice and Bob to use an insecure communication channel to agree on a shared random secret key that is subsequently used for symmetric-key encryption.

## 5.8. Definitions: Kerckhoff’s Principle

Let’s now examine the threat model, which in this setting involves answering the question: How powerful are the attackers Eve and Mallory?

To consider this question, recall *Kerckhoff’s principle* from the earlier notes about security principles:

Cryptosystems should remain secure even when the attacker knows all internal details of the system. The key should be the only thing that must be kept secret, and the system should be designed to make it easy to change keys that are leaked (or suspected to be leaked). If your secrets are leaked, it is usually a lot easier to change the key than to replace every instance of the running software. (This principle is closely related to

Shannon’s Maxim: Don’t rely on security through obscurity.)

Consistent with Kerckhoff’s principle, we will assume that the attacker knows the encryption and decryption algorithms. 1 The only information the attacker is missing is the secret key(s).

## 5.9. Definitions: Threat models

When analyzing the confidentiality of an encryption scheme, there are several possibilities about how much access an eavesdropping attacker Eve has to the insecure channel:

- Eve has managed to intercept a single encrypted message and wishes to recover the plaintext (the original message). This is known as a
*ciphertext-only attack*. - Eve has intercepted an encrypted message and also already has some partial information about the plaintext, which helps with deducing the nature of the encryption. This case is a
*known plaintext attack*. In this case Eve’s knowledge of the plaintext is partial, but often we instead consider complete knowledge of one instance of plaintext. - Eve can capture an encrypted message from Alice to Bob and re-send the encrypted message to Bob again. This is known as a
*replay attack*. For example, Eve captures the encryption of the message “Hey Bob’s Automatic Payment System: pay Eve $$100$” and sends it repeatedly to Bob so Eve gets paid multiple times. Eve might not know the decryption of the message, but she can still send the encryption repeatedly to carry out the attack. - Eve can trick Alice to encrypt arbitrary messages of Eve’s choice, for which Eve can then observe the resulting ciphertexts. (This might happen if Eve has access to the encryption system, or can generate external events that will lead Alice to sending predictable messages in response.) At some other point in time, Alice encrypts a message that is unknown to Eve; Eve intercepts the encryption of Alice’s message and aims to recover the message given what Eve has observed about previous encryptions. This case is known as a
*chosen-plaintext attack*. - Eve can trick Bob into decrypting some ciphertexts. Eve would like to use this to learn the decryption of some other ciphertext (different from the ciphertexts Eve tricked Bob into decrypting). This case is known as a
*chosen-ciphertext attack*. - A combination of the previous two cases: Eve can trick Alice into encrypting some messages of Eve’s choosing, and can trick Bob into decrypting some ciphertexts of Eve’s choosing. Eve would like to learn the decryption of some other ciphertext that was sent by Alice. (To avoid making this case trivial, Eve is not allowed to trick Bob into decrypting the ciphertext sent by Alice.) This case is known as a
*chosen-plaintext/ciphertext attack*, and is the most serious threat model.

Today, we usually insist that our encryption algorithms provide security against chosen-plaintext/ciphertext attacks, both because those attacks are practical in some settings, and because it is in fact feasible to provide good security even against this very powerful attack model.

However, for simplicity, this class will focus primarily on security against chosen-plaintext attacks.

- The story of the Enigma gives one possible justification for this assumption: given how widely the Enigma was used, it was inevitable that sooner or later the Allies would get their hands on an Enigma machine, and indeed they did. ↩

## What is Cryptography? A Complete Overview

Curated backend podcasts, videos and articles. All free.

If you’re looking to become a backend developer, or just stay up-to-date with the latest backend technologies and trends, you found the right place. Subscribe below to get a copy of our newsletter, The Boot.dev Beat, each month in your inbox. No spam, no sponsors, totally free.

## �� What is cryptography?

Simply put, Cryptography provides a method for secure communication. It stops unauthorized parties, commonly referred to as adversaries or hackers, from gaining access to the secret messages communicated between authorized parties. The method that cryptography provides is called *encryption*.

Encryption transforms a key and input, the *plaintext*, into an encrypted output, the *ciphertext*. Encryption algorithms are only considered secure if attackers cannot determine any properties of the plaintext or the key when presented with only the ciphertext. An attacker should not be able to find out *anything* about a key, even if they have many plaintext/ciphertext combinations that use that key.

A real-world example would be credit card information that you use for purchases on Amazon or other e-commerce sites. The code in your web browser encrypts the plaintext, your card number, into ciphertext, which to someone without the keys would look like illegible, random text. However, once your card number reaches its intended recipient, the online store, their software would decrypt it back into plaintext so they can charge you for your purchase.

## �� Principles of cryptography

The core principles of modern-day cryptography include:

- Confidentiality
- Integrity
- Non-repudiation
- Authentication

Let’s go over each one by one.

### �� Confidentiality

Data Confidentiality ensures that the data is limited to those who are authorized to view it. The data should only be visible to those who possess some critical information, like the decryption key, for example.

### �� Integrity

Data integrity refers to the accuracy, legitimacy, and consistency of information in a system. When a message is sent, particularly using an untrusted medium like the internet, data integrity ensures us that a message wasn’t tampered with or accidentally altered.

Let’s use the example of military orders. We’re at war and an army general needs to send an order of retreat to his troops across the sea. Without a guarantee of data integrity, a hacker could intercept the message, change the order, and send it on its way. The army might receive an order to advance and walk right into a trap the general knew about.

### �� Non-repudiation

Non-Repudiation assures that no one can deny the validity of the data in question, and is actually a legal term used in cyber security. Non-Repudiation is typically accomplished by the use of a service that provides proof of the origin and integrity of the information. It makes it nearly impossible to successfully deny who or where a message came from.

Non-repudiation is similar to data integrity, but it has more to do with knowing *who* sent the information, and less with whether or not it was *changed* along the way. In the military example from above, even if we could guarantee that the retreat order was never tampered with, non-repudiation would be a way to ensure it was the general who gave the order in the first place, and not some enemy spy.

### �� Authentication

There are two kinds of authentication typically used in cryptography.

- Integrity authentication like a MAC or HMAC ensures that data hasn’t been tampered with.
- Source authentication, like an SSL certificate, can be used to verify the identity of who created the information. Every time you connect to a website over HTTPS, your browser ensures that you’re connected to the site you think you are by checking the SSL certificate.

## �� Guidelines for cryptographers

Never try to design your own cryptosystem. The best cryptographers in the world routinely design cryptosystems with serious security flaws. As it turns out, it’s *really* hard to build a secure system. There are just too many attack vectors to consider.

For a cryptosystem to be considered “secure enough” it needs to go through intense scrutiny by the security community. “Security through obscurity”, or the fact that attackers may not have knowledge of your system, is something that should never be relied on. In fact, good systems do expose to attackers how they work. Only the private keys should be kept secret.

The enemy knows the system. One ought to design systems under the assumption that the enemy will immediately gain full familiarity with them.According to Kerckhoffs’s principle

Always take reasonable steps to protect any keys that your software systems use.

**Never** store encryption keys in plain text with the data they protect. That’s the virtual equivalent of locking your front door and leaving the key on the frame. It’s the first place an attacker will look.

Let’s take a look at a few rules of thumb for securely storing keys.

**Protect your private keys with strong access control lists**, or ACLs. Follow the principle of least privilege, that is, only allow those you really need the keys to get access to them.**Use a secure password or secret manager**to keep track of your keys. Good secret managers will encrypt your keys using a strong key-derivation function like bcrypt or scrypt.**In extreme cases, a hardware security module**is a physical device that can be used to store keys offline securely. Software applications can then access HSMs connected to the same machine. The HSM actualy performs decryption on the HSM itself, so the keys never leave the device.

Lastly, ensure you only use key strengths and operating modes that comply with the latest industry best practices. For example, AES-256 should typically be used over AES-128, if for no other reason than its larger key size provides more entropy when going up against a quantum algorithm.

## �� What practical problems does cryptography solve?

A secure system provides the four principles of cryptography to systems in the real world. Confidentiality, integrity, authentication, and non-repudiation are necessary properties in modern software, and they wouldn’t be possible without cryptography.

Software systems, especially those that exist on the web, often have many endpoints, clients, dependencies, networks, and servers. All the physical machines that are required to make your crossword app work need to communicate over networks that can not be trusted. Internet communication takes place over open, public networks that can be trivially compromised by external attackers.

There are two main types of attacks that exist on open networks:

**In a passive attack**: the hacker listens to a network connection and reads sensitive information as it is transmitted.**In an active attack**: the attacker impersonates a client or server, intercepts communications intended for it in transit, and modifies the information before forwarding it to its original destination.

The confidentiality and integrity protection provided by cryptographic protocols such as SSL/TLS can protect communications from malicious eavesdropping and tampering. Authentication protection ensures that the data you receive really came from who you thought it came from. For example, are you sending your social security number to your bank, or to a Nigerian prince?

Cryptography isn’t only useful for data in transit, it can also be used to protect data at rest. Data that is simply stored on a disk in a database can be encrypted to prevent future accesses from reading it. This kind of encryption happens when you lock your phone or computer and keeps your information safe if your devices are stolen.

## �� Types of cryptography

There are three main types of cryptography:

- Symmetric key encryption
- Asymmetric key encryption
- Hash functions

### �� Symmetric key cryptography

Symmetric encryption uses the **same key** for encryption and decryption. The sender and receiver of the message use a single shared key to encrypt and decrypt messages. Symmetric key systems are faster and simpler, but sharing keys is difficult. If you need to communicate over an insecure medium, how would you get the key to the recipient in the first place?

The answer is that for communication to another party, you’ll probably want to use asymmetric encryption, which we’ll cover shortly. Symmetric encryption excels when you’re encrypting information at rest. For example, your password manager encrypts your passwords, but they aren’t being sent to anyone. You only need one key, because you’re the only one using it.

Common symmetric encryption algorithms include AES and DES.

### �� Asymmetric key cryptography

Asymmetric encryption uses **different keys** for encryption and decryption. A pair of keys that are cryptographically related are used to encrypt and decrypt information. A public key is used for encryption while its private key is used for decryption.

If I want to receive a message from my wife, I would send her my public key. The public key is just that, public. If someone intercepts the key, it’s not a problem, they won’t be able to use it to decrypt anything.

My wife would then use my public key to encrypt a message for me. Now, since I’m the only one that owns the corresponding private key, I’ll be able to decrypt that message once I receive it.

Common asymmetric encryption algorithms ECC and RSA.

Properties | Symmetric | Asymmetric |
---|---|---|

Keys |
A single key | A private and public key |

Speed |
Faster, simple | Slower, more complex |

Use cases |
Bulk encryption of data at rest | Encryption of data in transit between two parties |

Principles provided |
Confidentiality | Confidentiality, authentication, non-repudiation |

### �� **Hash Functions**

**Hash Functions**

The third most common type of cryptography involves hash functions. No key is used in this algorithm. A fixed-length value is calculated from the plaintext, which makes it impossible for the contents of the plaintext to be recovered.

However, because the same plaintext will always hash to the same output, it can be used to, for example, compare passwords without ever storing them.

Popular hashing functions include SHA-256, Bcrypt, and Scrypt.

## �� Cryptology vs cryptography vs cryptanalysis

### �� Cryptology

Cryptology is the science of secret messages. Anything that has to do with making or breaking codes falls into cryptology’s domain. Cryptology can also be thought of as the study of encryption and decryption. In a nutshell, cryptography and cryptanalysis are the two branches under the umbrella of cryptology.

- Cryptography: Study of building secure cryptosystems.
- Cryptanalysis : Study of breaking cryptosystems.
- Cryptology: Study of both cryptography and cryptanalysis.

Cryptology is extremely heavy on mathematics, such as number theory and the application of formulas and algorithms. An interesting anecdote is that cryptology was the main field of study of the first computer scientists, including Alan Turing himself.

### �� Cryptography

People often lazily use “cryptography” in place of the word “cryptology”, but in reality, cryptography focuses only on building cryptosystems.

For example, the design of AES-256, the system that allows us to encrypt the personal information on our phones and laptops, would have been primarily *cryptography* work.

### �� Cryptanalysis

Cryptanalysis is the inverse of cryptography. It’s the study of how to break secret codes, not make them. Having a solid understanding of cryptanalysis is fundamental in cryptography, however, as one must know their enemy.

Imagine that the FBI gets ahold of your personal mobile phone, and they want to snoop around to see what you’ve been up to. The methods they would employ to “crack” the code and decrypt the contents of your phone would be cryptanalysis techniques.

For more information, we have a full post on cryptology vs cryptography

## �� What is quantum computing, and will quantum computing break cryptography?

Where a classical bit holds a single binary value such as 0 or 1 , a qubit can hold both values simultaneously. This means a single qubit can hold much more information than a classical bit, and all this is made possible by the phenomenon of superposition. This unique property allows them to process information in potentially logarithmic time, or in other words, exponentially faster than classical computers.

Many asymmetric encryption algorithms have been mathematically proven to be broken by quantum computers using Shor’s algorithm. Because algorithms like RSA rely heavily on the fact that normal computers can’t find prime factors quickly, they have remained secure for years. With quantum computers breaking that assumption, then it may be time to find new standards.

On the other hand, symmetric encryption, or more specifically AES-256, is believed to be quantum-resistant. That means that quantum computers are not expected to be able to reduce the attack time enough to be effective if the key sizes are large enough.

For more information, read our post on whether AES-256 is quantum resistant

## �� How do Bitcoin, cryptocurrency and other blockchains utilize cryptography?

Bitcoin and other cryptocurrencies rely on cryptographic algorithms to function, hence the “crypto” in the name. Bitcoin uses two primary cryptographic methods. The first is asymmetric encryption. A bitcoin wallet is, at its core, a collection of private keys that can be used to sign transactions on the network. Bitcoin and other blockchain technologies utilize cryptographic signatures, which are a form of asymmetric encryption, to guarantee that when you send a Bitcoin to your friend, it was actually you that sent it.

The second is hashing. Bitcoin mining makes use of the SHA-256 algorithm to act as a proof-of-work on the network. Because the output of hash functions can’t be easily guessed, the network can trust that an actor in the network has expended a good deal of energy computing the result of a calculation.

The reason we care that it took someone a lot of work to add a new block to the blockchain is to make it more secure. Every miner has to solve a difficult “hashing lottery” to add a new block, but if it were too easy, anyone could add new blocks quickly to rewrite the blockchain to their advantage. Proof-of-work consensus is what makes Bitcoin the most secure public network ever created in human history.

If you’re interested in reading more in-depth about how Bitcoin works, you can do so on bitcoin.org.

## �� History of cryptography – A timeline of important events

Cryptology is a *very* young science. Although humans have had rudimentary forms of cryptography for thousands of years, the systematic study of cryptology as a science only began about a hundred years ago. The advent of computers made cryptography many orders of magnitude more complex than it had been previously.

**1900 BC**– First evidence of altered symbols in text found in the tomb of Khnumhotep II in Egypt. The writings weren’t meant to be secret, but are the first evidence we have of someone altering encoding symbols.**100 BC**– Ceasar Cipher. Julius Caesar was known to use a form of encryption to convey secret messages to his army generals posted on the war front. This substitution cipher, known as the Caesar cipher, is perhaps the most mentioned historic cipher (an algorithm used for encryption or decryption) in academic literature. It’s a simple cipher where each character of the plain text is simply substituted by another character to form the ciphertext. For example, “a” becomes “d”, “b” becomes “e”, and so on.**500 AD**– Vigenere’s Cipher. Vigenere designed a cipher that is said to have been the first cipher to use a secret key.**1800**Hebern Rotor Machine. In the early 1800s, when everything became electric, Hebern designed an electromechanical device that used a single rotor in which the secret key is embedded in a rotating disk. The key encoded a substitution box and each keystroke on the keyboard resulted in the output of ciphertext. Like the caesar and vigenere ciphers, Hebern’s machine was broken by using letter frequencies.**1918**– Enigma Machine. The Engima machine was invented by German engineer Arthur Scherbius at the end of World War I and was heavily used by German forces during World War II. The Enigma machine used 3 or more rotors that spin at different speeds as you type on the keyboard and output corresponding letters of the ciphertext. In the case of Enigma, the key was the initial setting of the rotors.**1943**Alan Turing and others on his team at Bletchley Park, complete the “Heath Robinson”, a specialized machine for cipher-breaking. This team was also responsible for cracking the Enigma Machine during the second world war.**1948**– Claude Shannon writes a paper that is responsible for establishing our modern mathematical basis of information theory.**1970**– Lucifer Cipher. In the early 1970s, a team from IBM designed a cipher called Lucifer. The Nation Bureau of Standards (now NIST) in the U.S. put out a request for proposals for a block cipher that would become a national standard. Lucifer was eventually accepted and became DES (Data Encryption Standard).**1977**– RSA public key encryption invented by Ron Rivest, Adi Shamir and Leonard Adleman.**1991**– Phil Zimmermann releases PGP.**1994**– Secure Sockets Layer (SSL) encryption protocol released by Netscape, which now secures the majority of the modern web.**1994**– Peter Shor devises an algorithm which lets quantum computers determine the factorization of large integers quickly.**1997**– DES Broken by exhaustive search. In 1997 and the following years, DES was broken by an exhaustive search attack. The main problem with DES was the small size of the encryption key. As computing power increased, it became easy to brute force all the different combinations of the key to get a possible plaintext message.**2000**– AES accepted as DES replacement. In 1997, NIST again put out a request for proposal for a new block cipher. It received 50 submissions. In 2000, it accepted Rijndael, and christened it as AES or the Advanced Encryption Standard.**2004**– MD5 shown to be vulnerable to collisions**2009**– Bitcoin network launch

## �� For further study

**For beginners:** If you’ve been inspired to learn cryptography as a beginner to coding and computer science, we have an entire computer science course curriculum to take you from complete beginner to graduate level. As cryptography is a more advanced topic, we suggest you start with our Learn Python.

**For experienced coders:** We recommend our Learn Cryptography course which covers everything from the basics of encryption and brute force attacks to stream ciphers, block ciphers, and hash functions.

## Cryptography Explained

Cryptography is the art and science of secret writing. It is the foundation of online identity, privacy, and security. Only careful and well-executed application of cryptography will allow keeping private information hidden from prying eyes and ears. The origins of the term ‘cryptography’ itself stem from two words of the Greek language – κρυπτός (kryptós) meaning secret or hidden, and γράφειν (graphein) meaning writing.

Our modern world relies on electronic means for creating, storing, and transferring information. The security of this digital life owes much to cryptography. Cryptography intersects our daily lives in more ways people commonly realize.

## Practical Everyday Applications

Our mobile phones, computers, online services, and nearly all personal online communications rely on different cryptographic algorithms and methods for the protection of the privacy and integrity of the identities and data involved.

Over the course of an ordinary day, we use many, sometimes rather advanced, cryptographic devices – there are smartcards in our wallets, laptops on our desks, mobile phones in our pockets, vehicle information systems in our cars, electronic locks on our doors, and so on.

## Algorithms – Transforming Data

Cryptographic algorithms are the basic tools of this trade. An algorithm is a method or a technique that is applied to data. When an algorithm is used to encrypt (hide) the data, the readable information (often referred to as “plaintext”) is transformed to an unreadable (encrypted) form. When an encrypted data (or “ciphertext”) is returned to its readable form the process is called decryption.

Some algorithms are bi-directional (or symmetric) which means that the same algorithm (and key) are used for both encryption and decryption. In contrast, a one-directional algorithm works in only one way (ie. the operation cannot be reversed). An example of a one-directional cryptographic algorithm is a hash algorithm that produces a hash – a digital “fingerprint” of the processed data. The hash reliably identifies the origina data and no two data sets produce the same hash, yet this digital fingerprint cannot be turned back into the original data.

There are three main categories of these algorithms:

*Public key*cryptography algorithms- Data
*integrity protection*algorithms *Symmetric cipher algorithms*.

Roughly these three categories of algorithms cater for three different basic needs:

- Reliable
*authentication*(of users and other entities) - Data
*integrity protection* - Protection of data
*privacy*.

This division is somewhat of a simplification, but will serve for this article. For a more thorough analysis, see an authoritative source such as Applied Cryptography by Mr Bruce Schneier .

## Authentication with Public Keys

While public key cryptography allows data encryption for privacy protection (and is used for that in some cases such as the PGP email protection scheme), it is cumbersome and computationally expensive to be used for bulk data protection. Instead, it is most commonly used to implement strong online authentication.

Strong authentication is the most prominent use case of public key cryptography, and in this role we (often unknowingly) use it daily.

Important concepts in public key cryptosystems are:

- Key pairs that consist of a public key and a private key
- Public key cryptography algorithms such as RSA , DSA , and ECDSA
- Key lengths. For more information, see key size guidelines

## Practical Uses of Asymmetric Crypto

Asymmetric cryptography and private/public key pairs are used extensively in smart card authentication , SSH public key authentication , and authenticating the servers of HTTPS-secured online services.

Asymmetric cryptography is the central technology behind Public Key Infrastructure (PKI) that allows scalable issuance, revocation, and management of digital certificates. Certificates are used for strong authentication, and digital signatures and they form the basis of trust for other security methods and protocols, such as SSL/TLS. PKI has sometimes been called the ID card office of the Internet, as PKI allows for reliable, 3rd party vouched for identity verification of peers that have not encountered each other before.

## Integrity Protection

Our daily lives break down into amazing volumes of data every day – our health records, financial information, employment records, service subscriptions, and other parts of our everyday life, are recorded in and transmitted between various online systems. The fabric of our lives is dependent on the integrity of that staggering mass of data – every bit of this information must stay exactly as it is. The integrity of data keeps us alive – in some cases quite literally.

Cryptography offers methods for protecting and inspecting the integrity of digital data in the form of hashing and message digest algorithms. These one-way functions can take a given piece of data of arbitrary size and calculate a unique, small fingerprint of that data. This fingerprint, the hash, is unique to that particular piece of data, and even a tiny change in the data results in an entirely different hash. These hashes allow the detection of modifications in data and are an essential component of any cryptosystem that requires the protection of data integrity.

SHA-1 and SHA-2 are common hash algorithms .

## Practical Uses of Hash Algorithms

Ensuring the integrity of data that has been received from online sources is one of the most common practical applications of hash algorithms. A rather simple and manual example of using hashes are various file download scenarios, where published hashes allow downloaders to verify the integrity of the file they receive.

In a more advanced and automated way, the different hash algorithms have been integrated in secure communications protocols, virus scanners, content management systems, and e-commerce platforms. In these practical applications, cryptographic hashes and message digests are being used to ensure the integrity of data as it traverses between systems and networks.

### Data Privacy Protection

The most common and probably easiest understood use of cryptography are the symmetric ciphers . A symmetric encryption algorithm is a method that renders data “hidden” when applied in one direction and returns the data readable when used in the other direction. The symmetric (secret) key functions like the password for the protected data. These algorithms are typically rather fast to execute, and they are used extensively to guarantee the privacy of data in network communications, databases/hard drives, and other applications where relatively large volumes of data need to be cryptographically processed in real time (or close to real time).

Since the key that is used for data encryption and decryption needs to be shared with each endpoint of the encrypted connection, or with every recipient of the encrypted data, the key generation and exchange are a critical feature of cryptosystems that use symmetric ciphers. A common key exchange mechanism in security protocols is the Diffie-Hellman key exchange .

Common symmetric ciphers are for example:

## Practical Uses of Symmetric Ciphers

Symmetric ciphers are used in secure online communications in countless ways. The Virtual Private Networks (VPNs) that connect remote branches into a single corporate network protect data communications with protocols that use symmetric ciphers – encryption is the magic behind SSL, IPsec, SSH , and other network security protocols. Symmetric ciphers also protect data privacy in mobile telephony, most WiFi networks, and in practically every online banking and e-commerce service.

Data at rest solutions utilize fast symmetric encryption algorithms for encrypting disk contents against illegitimate use. A common encryption algorithm in this use case is the AES-XTS .

## Cryptographic Keys and Key Management

A cryptosystem is a multiple of its parts – an essential security concern on any system is the way the encryption keys are managed. Even the strongest encryption algorithm offers no security if the attacker can get access to the encryption keys .

Enterprise networks in general have been designed with careful considerations for identity and access management. The guiding principles of providing access to resources based on the role of an individual (be it a user or a process) or of segregation of duties provide a starting point for a well-designed access control implementation. These principles need to be applied to practice in all aspects of enterprise access. So far the user-level access control has been in the spotlight of IAM, but in recent times the focus has been shifting towards the so far unaddressed issues of trusted access.

We at SSH secure communications between systems, automated applications, and people. We strive to build future-proof and safe communications for businesses and organizations to grow safely in the digital world.

- Solutions
- Zero Trust Suite
- Quantum-Safe Cryptography (QSC)
- Secure Collaboration 2024
- Security Risk Mitigation
- OT security
- MSP Security
- Secure Active Directory
- Just-in-Time Access
- Secure vendor access
- Hybrid cloud security
- Credentials & Secrets Management
- IT Audits & Compliance

- PrivX™ Hybrid PAM
- UKM Zero Trust™
- Tectia SSH Client/Server™
- Tectia™ z/OS
- SSH Secure Collaboration 2024
- Secure Mail 2024
- Secure Sign
- NQX™ Quantum-Safe

- SSH Risk Assessment™
- Professional Services
- Support

- Careers
- References
- Downloads
- Manuals
- Events & Webinars
- Blog

- About us
- Contact
- Investors
- Partners
- Press

#### Stay on top of the latest in cybersecurity

Be the first to know about SSH’s new solutions, product

updates, new features, and other SSH news!