Symmetric Key — Definition, Formula & Example
A symmetric key is a single secret key that two people share and use both to lock (encrypt) and unlock (decrypt) a message. Anyone who has the key can read the messages, so the key must stay private between the sender and the receiver.
A symmetric-key encryption scheme consists of a key space , a message space , a ciphertext space , and functions and . These functions satisfy for every key and every message . For each fixed , the function is injective, and is its inverse on the image of . The same serves both operations. Public-key schemes differ here because they use a key pair.
Key Formula
Where:
- = plaintext letter as a number, with A = 0, B = 1, ..., Z = 25
- = the shared secret key, an integer from 0 to 25
- = ciphertext letter as a number from 0 to 25
- = encryption and decryption functions for key k (shift cipher)
Worked Example
Problem: Alice and Bob share the secret key . Alice encrypts the word MATH with the shift cipher. Then Bob decrypts the result using the same key.
Step 1: Convert each letter to a number using A = 0 through Z = 25.
Step 2: Alice adds the key to each number and reduces mod 26. Note that , which wraps around to 0.
Step 3: Bob subtracts the same key and reduces mod 26. For the third letter, , and .
Answer: The ciphertext is THAO. Decrypting with the same key recovers MATH. The one shared key performs both directions.
Why It Matters
Symmetric ciphers such as AES encrypt nearly all bulk data on the internet, including HTTPS traffic and disk encryption. They are fast, but every pair of users needs its own secret key. A network of 100 people would need keys. This key-distribution problem is why public-key methods like RSA, studied in number theory and discrete math courses, are used to exchange symmetric keys safely.
Common Mistakes
Mistake: Thinking that "symmetric" means encryption and decryption are the same operation.
Correction: The key is what is shared, not the operation. Decryption is the inverse function of encryption. In the shift cipher you add to encrypt and subtract to decrypt. Applying twice does not undo it in general.
