Keyword Cipher

The Keyword Cipher is a monoalphabetic substitution cipher where a keyword is used to generate the cipher alphabet. The keyword is written first (with duplicate letters removed), followed by the remaining letters of the alphabet in order. This creates a one-to-one mapping between plaintext and ciphertext letters.

10Worksheets
200+Practice Questions
IntermediateDifficulty
2-3 hoursHours to Master

Introduction to Keyword Cipher

The Keyword Cipher is a monoalphabetic substitution cipher where a keyword is used to generate the cipher alphabet. The keyword is written first (with duplicate letters removed), followed by the remaining letters of the alphabet in order. This creates a one-to-one mapping between plaintext and ciphertext letters.

Prerequisites

Alphabet positions Keyword deduplication Substitution cipher concepts Mapping between alphabets
Why This Matters: Keyword Cipher problems appear in 1-2 questions in SSC CGL and Banking PO exams. They test understanding of substitution cipher construction.

How to Solve Keyword Cipher Problems

1

Step 1: Write the keyword in uppercase and remove duplicate letters (keep first occurrence)

2

Step 2: Append the remaining letters of the alphabet in order (excluding those in the keyword)

3

Step 3: This creates the cipher alphabet (A-Z maps to this string)

4

Step 4: For encoding, replace each plaintext letter with the cipher letter at the same position

5

Step 5: For decoding, find the position of the cipher letter in the cipher alphabet and output the plaintext letter at that position

6

Step 6: Build a mapping table for quick reference

Pro Strategy: Always remove duplicate letters from the keyword before constructing the cipher alphabet. The cipher alphabet has exactly 26 letters. Create a mapping dictionary for encoding and a reverse mapping for decoding.

Example Problem

Example: Using keyword 'CIPHER', what is the cipher for 'HELLO'? Solution: Step 1: Keyword: C I P H E R (no duplicates) Step 2: Remaining letters: A B D F G J K L M N O Q S T U V W X Y Z Step 3: Cipher alphabet: C I P H E R A B D F G J K L M N O Q S T U V W X Y Z Step 4: Plaintext A→C, B→I, C→P, D→H, E→E, F→R, G→A, H→B, I→D, J→F, K→G, L→J, M→K, N→L, O→M, P→N, Q→O, R→Q, S→S, T→T, U→U, V→V, W→W, X→X, Y→Y, Z→Z Step 5: HELLO: H→B, E→E, L→J, L→J, O→M → BEJJM Answer: BEJJM

Pro Tips & Tricks

  • The keyword determines the entire cipher alphabet
  • Duplicate letters in the keyword are ignored (only first occurrence kept)
  • The cipher alphabet preserves the order of remaining letters (A-Z)
  • Common keywords: 'CIPHER', 'SECRET', 'KEYWORD', 'ALPHABET'
  • The letter that appears first in the keyword is often the most frequent
  • To decode, create a reverse mapping from cipher letter to plaintext letter

Shortcut Methods to Solve Faster

Cipher alphabet = keyword_without_duplicates + remaining_letters_in_order
Encoding: cipher[plaintext_index] where plaintext_index = ord(letter)-ord('A')
Decoding: find index of cipher letter in cipher alphabet, then output chr(index+ord('A'))

Common Mistakes to Avoid

Forgetting to remove duplicate letters from the keyword
Including the keyword letters again in the remaining alphabet
Using the cipher alphabet in reverse order for decoding
Not maintaining case consistency (use uppercase)

Exam Importance

Keyword Cipher is an important topic for various competitive exams. Here's how frequently it appears:

SSC CGL
1-2 questions
BANKING PO
1-2 questions
RAILWAYS RRB
1-2 questions
CAT
1-2 questions
INSURANCE
1-2 questions

Ready to Master Keyword Cipher?

Start with Worksheet 1 and work your way up to expert level! Each worksheet includes:

20 practice questions
Detailed solutions
Step-by-step explanations
Start Practicing Now