Cryptography in 3D

A low-poly orange padlock with a grey shackle, a common symbol for encryption and security.Drag to turn

Cryptography is the study of mathematical methods that protect information so that only intended parties can read it, change it, or confirm who sent it. It covers encryption, hashing, and digital signatures.

What cryptography protects

Cryptography turns readable data, called plaintext, into unreadable data, called ciphertext, using an algorithm and a value called a key. Reversing the process to recover the plaintext is called decryption. The goal is to protect data while it is stored or sent across a network where others may see it.

Textbooks usually name four aims. Confidentiality means only authorised parties can read the data. Integrity means changes can be detected. Authentication means a party can prove its identity. Non-repudiation means a sender cannot credibly deny having sent a message.

Symmetric keys, public keys and hashes

Symmetric encryption uses one shared key for both encryption and decryption. It is fast, so it is used for large amounts of data. The weakness is key distribution, because both parties must obtain the key safely.

Public-key cryptography uses a pair of keys. The public key can be shared openly, and the private key stays secret. Data encrypted with the public key can be decrypted only with the matching private key. A digital signature reverses the roles in effect: the private key signs, and anyone can check the result with the public key.

A hash function maps any input to a fixed-size output called a digest. It uses no key. A good hash is one-way, so the input cannot feasibly be recovered from the digest, and a small change in input gives a very different digest.

A worked example: the Caesar cipher

The Caesar cipher is a simple symmetric cipher that shifts each letter forward by a fixed number of places. Here the key is 3. Number the letters A=0, B=1, and so on up to Z=25. Take the word CAT. C is 2, and 2 + 3 = 5, which is F. A is 0, and 0 + 3 = 3, which is D. T is 19, and 19 + 3 = 22, which is W. The ciphertext is FDW.

To decrypt, subtract 3. For W, 22 - 3 = 19, which is T. If a shift passes Z, it wraps around, so X (23) becomes 23 + 3 = 26, and 26 mod 26 = 0, which is A. The cipher is easy to break because only 25 useful keys exist, and an attacker can try them all. Modern ciphers use key spaces so large that trying every key is infeasible.

Common misconceptions

Hashing is not encryption. Encryption is meant to be reversed with a key, while a hash is meant not to be reversed. Storing passwords usually involves a slow hash with a random value called a salt, not encryption.

Keeping the algorithm secret does not make a system secure. The standard principle, named after Kerckhoffs, says security should rest on the key alone, even if the method is public. Encryption also does not guarantee safety on its own, since weak passwords, software bugs, and stolen keys can still expose data.

Where cryptography shows up

Web browsers use TLS, the protocol behind HTTPS, to protect traffic between a client and a server. It usually uses public-key methods to agree on a shared key, then symmetric encryption for the data. Messaging apps, disk encryption, and software updates rely on the same building blocks.

Databases store password hashes, and digital signatures let systems verify that downloaded software has not been altered.

Key terms

Plaintext
Readable data before encryption.
Ciphertext
Data after encryption, unreadable without the key.
Key
A value that controls how an algorithm encrypts, decrypts, signs or verifies. Symmetric keys and private keys must be kept secret, while a public key is meant to be shared.
Symmetric encryption
Encryption where the same key encrypts and decrypts.
Public-key cryptography
A system using a public key and a matching private key.
Hash function
A one-way function that maps input to a fixed-size digest.
Digital signature
A value made with a private key that proves origin and integrity.

Common questions

Why is public-key cryptography not used for everything?

It is usually much slower than symmetric encryption. Systems often use it only to exchange a symmetric key, then switch to the faster method.

What is a salt in password storage?

A salt is a random value added to a password before hashing. It makes identical passwords produce different digests and defeats precomputed lookup tables.

Can a hash be decrypted?

No. A hash is designed to be one-way. Attackers can only guess inputs and compare digests, which is why strong passwords and slow hashes matter.

Learn this with a tutor

Sidechair's AI tutor will teach this topic in 3D. Join the waitlist for early access.

We'll only email you about Sidechair. Read our privacy policy.