One of the first topics often taught in an abstract algebra class is permutations, since they provide good examples of non-commutative finite groups which the students can manipulate and visualize. This visualization is often done through symmetry groups. For students who are less geometrically inclined, however, the use of permutation ciphers provides another good way of motivating permutations. They can easily be used to illustrate composition, non-commutativity, inverses, and the order of group elements, which are fundamental topics in group theory. We will give examples of how this can be done and suggest other courses besides abstract algebra in which this could also prove useful.
The Pohlig-Hellman Exponentiation Cipher as a Bridge Between Classical and Mo...
Teaching the Group Theory of Permutation Ciphers
1. Teaching the Group Theory of Permutation Ciphers
Joshua Holden
Rose-Hulman Institute of Technology
http://www.rose-hulman.edu/~holden
Joshua Holden (RHIT) Group Theory of Permutation Ciphers 1 / 13
2. A historical example
Taj ad-Din Ali ibn ad-Duraihim (1312–1361), worked and taught in
Damascus and Cairo.
In a book that was considered lost until the late 20th century, ibn
ad-Duraihim described 24 variations of transposition ciphers.
Example
plaintext: dr in kt ot he ro se
ciphertext: RD NI TK TO EH OR ES
Joshua Holden (RHIT) Group Theory of Permutation Ciphers 2 / 13
3. So what?
We are seeing the first explicit example of a permutation cipher.
Definition
A permutation is a bijection from a finite set to itself.
Example
plaintext: dr in kt ot he ro se
ciphertext: RD NI TK TO EH OR ES
Ibn ad-Duraihim’s permutation is
1 2
2 1
:
Joshua Holden (RHIT) Group Theory of Permutation Ciphers 3 / 13
4. Another example
Example
plaintext: ruby wine
ciphertext: UYBR IENW
This is a cipher based on the permutation
1 2 3 4
2 4 3 1
:
Note
Some people prefer to use a notation based on where the letters go.
We will use one based on where they come from.
Joshua Holden (RHIT) Group Theory of Permutation Ciphers 4 / 13
5. Keys and keywords
Clearly the key to a permutation cipher is the permutation.
We can choose and remember a permutation by a keyword.
Example
TALE is a keyword for the permutation
1 2 3 4
2 4 3 1
:
plaintext: thep aper andt hepe nllu
Joshua Holden (RHIT) Group Theory of Permutation Ciphers 5 / 13
6. Keys and keywords
Clearly the key to a permutation cipher is the permutation.
We can choose and remember a permutation by a keyword.
Example
TALE is a keyword for the permutation
1 2 3 4
2 4 3 1
:
keyword: TALE TALE TALE TALE TALE
plaintext: thep aper andt hepe nllu
Joshua Holden (RHIT) Group Theory of Permutation Ciphers 5 / 13
7. Keys and keywords
Clearly the key to a permutation cipher is the permutation.
We can choose and remember a permutation by a keyword.
Example
TALE is a keyword for the permutation
1 2 3 4
2 4 3 1
:
4132 4132 4132 4132 4132
keyword: TALE TALE TALE TALE TALE
plaintext: thep aper andt hepe nllu
Joshua Holden (RHIT) Group Theory of Permutation Ciphers 5 / 13
8. Keys and keywords
Clearly the key to a permutation cipher is the permutation.
We can choose and remember a permutation by a keyword.
Example
TALE is a keyword for the permutation
1 2 3 4
2 4 3 1
:
4132 4132 4132 4132 4132
keyword: TALE TALE TALE TALE TALE
plaintext: thep aper andt hepe nllu
ciphertext: HPET PREA NTDA EEPH LULN
Joshua Holden (RHIT) Group Theory of Permutation Ciphers 5 / 13
9. Keys and keywords
Clearly the key to a permutation cipher is the permutation.
We can choose and remember a permutation by a keyword.
Example
TALE is a keyword for the permutation
1 2 3 4
2 4 3 1
:
4132 4132 4132 4132 4132
keyword: TALE TALE TALE TALE TALE
plaintext: thep aper andt hepe nllu
ciphertext: HPET PREA NTDA EEPH LULN
HPETP REANT DAEEP HLULN
Joshua Holden (RHIT) Group Theory of Permutation Ciphers 5 / 13
10. Deciphering
In order to decipher, you need to take the inverse of the permutation.
The inverse of
1 2 3 4
2 4 3 1
is
1 2 3 4
4 1 3 2
.
Note
We saw the numbers 4132 earlier!
Equivalently, alphabetize the keyword and read off the plaintext in
original keyword order:
Example
ciphertext: HBET TLTA ADNE HSET ODRW
Joshua Holden (RHIT) Group Theory of Permutation Ciphers 6 / 13
11. Deciphering
In order to decipher, you need to take the inverse of the permutation.
The inverse of
1 2 3 4
2 4 3 1
is
1 2 3 4
4 1 3 2
.
Note
We saw the numbers 4132 earlier!
Equivalently, alphabetize the keyword and read off the plaintext in
original keyword order:
Example
keyword: AELT AELT AELT AELT AELT
ciphertext: HBET TLTA ADNE HSET ODRW
Joshua Holden (RHIT) Group Theory of Permutation Ciphers 6 / 13
12. Deciphering
In order to decipher, you need to take the inverse of the permutation.
The inverse of
1 2 3 4
2 4 3 1
is
1 2 3 4
4 1 3 2
.
Note
We saw the numbers 4132 earlier!
Equivalently, alphabetize the keyword and read off the plaintext in
original keyword order:
Example
2431 2431 2431 2431 2431
keyword: AELT AELT AELT AELT AELT
ciphertext: HBET TLTA ADNE HSET ODRW
Joshua Holden (RHIT) Group Theory of Permutation Ciphers 6 / 13
13. Deciphering
In order to decipher, you need to take the inverse of the permutation.
The inverse of
1 2 3 4
2 4 3 1
is
1 2 3 4
4 1 3 2
.
Note
We saw the numbers 4132 earlier!
Equivalently, alphabetize the keyword and read off the plaintext in
original keyword order:
Example
2431 2431 2431 2431 2431
keyword: AELT AELT AELT AELT AELT
ciphertext: HBET TLTA ADNE HSET ODRW
plaintext: theb attl eand thes word
Joshua Holden (RHIT) Group Theory of Permutation Ciphers 6 / 13
14. How many keys?
The number of keys for a permutation cipher on n letters is the number
of permutations, n!.
But one of them gives the trivial cipher:
Example
plaintext: ruby wine
Joshua Holden (RHIT) Group Theory of Permutation Ciphers 7 / 13
15. How many keys?
The number of keys for a permutation cipher on n letters is the number
of permutations, n!.
But one of them gives the trivial cipher:
Example
keyword: ABCD ABCD
plaintext: ruby wine
Joshua Holden (RHIT) Group Theory of Permutation Ciphers 7 / 13
16. How many keys?
The number of keys for a permutation cipher on n letters is the number
of permutations, n!.
But one of them gives the trivial cipher:
Example
1234 1234
keyword: ABCD ABCD
plaintext: ruby wine
Joshua Holden (RHIT) Group Theory of Permutation Ciphers 7 / 13
17. How many keys?
The number of keys for a permutation cipher on n letters is the number
of permutations, n!.
But one of them gives the trivial cipher:
Example
1234 1234
keyword: ABCD ABCD
plaintext: ruby wine
ciphertext: RUBY WINE
Joshua Holden (RHIT) Group Theory of Permutation Ciphers 7 / 13
18. Double encipherment?
Can we improve the security of a permutation cipher by using two
different keys?
Example
4132 4132 4132 4132 4132
keyword: TALE TALE TALE TALE TALE
plaintext: thep aper andt hepe nllu
first ciphertext: HPET PREA NTDA EEPH LULN
4312 4312 4312 4312 4312
keyword: POEM POEM POEM POEM POEM
first ciphertext: hpet prea ntda eeph luln
second ciphertext: ETPH EARP DATN PHEE LNUL
Joshua Holden (RHIT) Group Theory of Permutation Ciphers 8 / 13
19. But look:
Example
plaintext: thep aper andt hepe nllu
second ciphertext: ETPH EARP DATN PHEE LNUL
This is the same as if you had just used the key
.
1 2 3 4
3 1 4 2
The combination of two ciphers is called a product cipher.
In fact:
1 2 3 4
2 4 3 1
1 2 3 4
3 4 2 1
=
:
1 2 3 4
3 1 4 2
Note
Not everyone writes permutation products in the same order, either.
Joshua Holden (RHIT) Group Theory of Permutation Ciphers 9 / 13
20. Noncommutativity
Note that
1 2 3 4
2 4 3 1
1 2 3 4
3 4 2 1
is not the same as
1 2 3 4
3 4 2 1
1 2 3 4
2 4 3 1
:
(I.e., permutation products are not commutative.)
If you don’t believe it, try encrypting our plaintext using the keyword
POEM first and then the keyword TALE.
Joshua Holden (RHIT) Group Theory of Permutation Ciphers 10 / 13
21. Bad keys
Some ciphers have bad keys — they don’t decrypt properly.
Example
1 2 3 4
looks like a permutation, but...
4 1 1 3
plaintext: garb agei ngar bage outx
Joshua Holden (RHIT) Group Theory of Permutation Ciphers 11 / 13
22. Bad keys
Some ciphers have bad keys — they don’t decrypt properly.
Example
1 2 3 4
looks like a permutation, but...
4 1 1 3
plaintext: garb agei ngar bage outx
ciphertext: BGGR IAAE RNNA EBBG XOOT
Joshua Holden (RHIT) Group Theory of Permutation Ciphers 11 / 13
23. Bad keys
Some ciphers have bad keys — they don’t decrypt properly.
Example
1 2 3 4
looks like a permutation, but...
4 1 1 3
plaintext: garb agei ngar bage outx
ciphertext: BGGR IAAE RNNA EBBG XOOT
plaintext: g?rb a?ei n?ar b?ge o?tx
It’s a function but not a permutation — it doesn’t have an inverse.
Joshua Holden (RHIT) Group Theory of Permutation Ciphers 11 / 13
24. Group theory
Okay, what about the math? So far we’ve actually covered:
An example of a group, the permutation (cipher)s on n letters.
(Actually, infinitely many groups!)
The order of the group (number of keys).
The group identity, the trivial permutation (cipher).
Inverses in the group, i.e. decryption.
The group operation, permutation (cipher) products.
Noncommutativity — permutations are not commutative, and
neither are permutation ciphers.
A set which contains a group, but is not a group, because it is not
closed under inverses, i.e. functions.
Joshua Holden (RHIT) Group Theory of Permutation Ciphers 12 / 13
25. HNAT SOFK LSIR EINT GZXN
NOJET EHYET EMNSG IEOUA
Joshua Holden (RHIT) Group Theory of Permutation Ciphers 13 / 13