Cryptography
Cryptography is the practice and study of secure communication. It involves techniques to protect data and messages so that only the intended people can read or use them, even if others try to access them.
The word "cryptography" comes from Greek words meaning "hidden writing." It's essential for keeping information secret, ensuring it hasn't been changed, and proving who sent it.
Contents
Overview and Purpose
Imagine you want to send a secret message. Cryptography helps you scramble that message (encrypt it) so it looks like gibberish to anyone who intercepts it. Only the person with the special "key" can unscramble (decrypt) it back to the original message.
The main goals of cryptography are:
- Confidentiality: Keeping information secret from unauthorized people.
- Integrity: Making sure information hasn't been changed.
- Authentication: Proving that the sender or receiver is who they claim to be.
- Non-repudiation: Preventing someone from denying they sent a message.
How it Works (Basic Idea)
Cryptography often uses mathematical algorithms (step-by-step instructions) and keys.
1. **Plaintext:** Your original, readable message. 2. **Encryption:** Using an algorithm and a secret key, the plaintext is scrambled into an unreadable form. 3. **Ciphertext:** The scrambled, unreadable message. 4. **Decryption:** The intended receiver uses a corresponding key and the same (or a related) algorithm to unscramble the ciphertext back into plaintext.
Types of Cryptography
There are two main types of cryptography based on how keys are used:
- Symmetric-key Cryptography
- Uses the same secret key for both encryption and decryption. Both the sender and receiver must have this shared secret key.
- *Example:* AES is a widely used symmetric-key algorithm.
- Asymmetric-key Cryptography (Public-key Cryptography)
- Uses two different but related keys: a public key and a private key.
- The **public key** can be shared freely and is used to encrypt messages or verify signatures.
- The **private key** must be kept secret by its owner and is used to decrypt messages or create signatures.
- *Example:* RSA and ECC are common asymmetric-key algorithms.
- Hash Functions
- These are not used for encryption/decryption with keys. Instead, they take any input data and produce a fixed-size, unique "fingerprint" (called a hash or digest). Even a tiny change to the input data will produce a totally different hash. Hash functions are used to check data integrity (if it has been tampered with) and for password storage.
History
Cryptography has been used for thousands of years. Early methods involved simple substitution ciphers (like the Caesar cipher, where letters are shifted in the alphabet) or transposition ciphers (where letters are rearranged).
In the 20th century, machines like the Enigma machine (used in WWII) brought more complex methods. The rise of computers led to modern cryptography, which is based on complex mathematics. The invention of Public-key cryptography in the 1970s was a huge breakthrough, allowing secure communication without needing to share a secret key beforehand.
Everyday Uses
Cryptography is all around us, often working silently in the background:
- Secure Websites: When you see "HTTPS" in a web address, cryptography is securing your connection (e.g., when online banking or shopping).
- Online Payments: Your credit card details are encrypted when you buy things online.
- Messaging Apps: Apps like WhatsApp use end-to-end encryption, meaning only the sender and receiver can read messages.
- Passwords: Your passwords are often stored as cryptographic hashes, so even if a database is breached, your actual password isn't revealed.
- Digital Signatures: Cryptography helps confirm that a digital document hasn't been changed and came from a specific sender.
- Cryptocurrencies: Digital currencies like Bitcoin heavily rely on cryptography for security and to verify transactions.