teaching the group theory of permutation ciphers
DESCRIPTION
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.TRANSCRIPT
Teaching the Group Theory of Permutation Ciphers
Joshua Holden
Rose-Hulman Institute of Technologyhttp://www.rose-hulman.edu/~holden
Joshua Holden (RHIT) Group Theory of Permutation Ciphers 1 / 13
A historical example
Taj ad-Din Ali ibn ad-Duraihim (1312–1361), worked and taught inDamascus and Cairo.
In a book that was considered lost until the late 20th century, ibnad-Duraihim described 24 variations of transposition ciphers.
Example
plaintext: dr in kt ot he ro seciphertext: RD NI TK TO EH OR ES
Joshua Holden (RHIT) Group Theory of Permutation Ciphers 2 / 13
So what?
We are seeing the first explicit example of a permutation cipher.
DefinitionA permutation is a bijection from a finite set to itself.
Example
plaintext: dr in kt ot he ro seciphertext: RD NI TK TO EH OR ES
Ibn ad-Duraihim’s permutation is(
1 22 1
).
Joshua Holden (RHIT) Group Theory of Permutation Ciphers 3 / 13
Another example
Exampleplaintext: ruby wineciphertext: UYBR IENW
This is a cipher based on the permutation(
1 2 3 42 4 3 1
).
NoteSome 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
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 42 4 3 1
).
4132 4132 4132 4132 4132keyword: 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
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 42 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
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 42 4 3 1
).
4132 4132 4132 4132 4132keyword: 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
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 42 4 3 1
).
4132 4132 4132 4132 4132keyword: TALE TALE TALE TALE TALE
plaintext: thep aper andt hepe nlluciphertext: HPET PREA NTDA EEPH LULN
HPETP REANT DAEEP HLULN
Joshua Holden (RHIT) Group Theory of Permutation Ciphers 5 / 13
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 42 4 3 1
).
4132 4132 4132 4132 4132keyword: TALE TALE TALE TALE TALE
plaintext: thep aper andt hepe nlluciphertext: HPET PREA NTDA EEPH LULN
HPETP REANT DAEEP HLULN
Joshua Holden (RHIT) Group Theory of Permutation Ciphers 5 / 13
Deciphering
In order to decipher, you need to take the inverse of the permutation.
The inverse of(
1 2 3 42 4 3 1
)is(
1 2 3 44 1 3 2
).
NoteWe saw the numbers 4132 earlier!
Equivalently, alphabetize the keyword and read off the plaintext inoriginal keyword order:
Example
2431 2431 2431 2431 2431keyword: 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
Deciphering
In order to decipher, you need to take the inverse of the permutation.
The inverse of(
1 2 3 42 4 3 1
)is(
1 2 3 44 1 3 2
).
NoteWe saw the numbers 4132 earlier!
Equivalently, alphabetize the keyword and read off the plaintext inoriginal 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
Deciphering
In order to decipher, you need to take the inverse of the permutation.
The inverse of(
1 2 3 42 4 3 1
)is(
1 2 3 44 1 3 2
).
NoteWe saw the numbers 4132 earlier!
Equivalently, alphabetize the keyword and read off the plaintext inoriginal keyword order:
Example
2431 2431 2431 2431 2431keyword: 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
Deciphering
In order to decipher, you need to take the inverse of the permutation.
The inverse of(
1 2 3 42 4 3 1
)is(
1 2 3 44 1 3 2
).
NoteWe saw the numbers 4132 earlier!
Equivalently, alphabetize the keyword and read off the plaintext inoriginal keyword order:
Example
2431 2431 2431 2431 2431keyword: AELT AELT AELT AELT AELT
ciphertext: HBET TLTA ADNE HSET ODRWplaintext: theb attl eand thes word
Joshua Holden (RHIT) Group Theory of Permutation Ciphers 6 / 13
How many keys?
The number of keys for a permutation cipher on n letters is the numberof permutations, n!.
But one of them gives the trivial cipher:
Example
1234 1234keyword: ABCD ABCD
plaintext: ruby wine
ciphertext: RUBY WINE
Joshua Holden (RHIT) Group Theory of Permutation Ciphers 7 / 13
How many keys?
The number of keys for a permutation cipher on n letters is the numberof 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
How many keys?
The number of keys for a permutation cipher on n letters is the numberof permutations, n!.
But one of them gives the trivial cipher:
Example
1234 1234keyword: ABCD ABCD
plaintext: ruby wine
ciphertext: RUBY WINE
Joshua Holden (RHIT) Group Theory of Permutation Ciphers 7 / 13
How many keys?
The number of keys for a permutation cipher on n letters is the numberof permutations, n!.
But one of them gives the trivial cipher:
Example
1234 1234keyword: ABCD ABCD
plaintext: ruby wineciphertext: RUBY WINE
Joshua Holden (RHIT) Group Theory of Permutation Ciphers 7 / 13
Double encipherment?
Can we improve the security of a permutation cipher by using twodifferent keys?
Example
4132 4132 4132 4132 4132keyword: TALE TALE TALE TALE TALE
plaintext: thep aper andt hepe nllufirst ciphertext: HPET PREA NTDA EEPH LULN
4312 4312 4312 4312 4312keyword: POEM POEM POEM POEM POEM
first ciphertext: hpet prea ntda eeph lulnsecond ciphertext: ETPH EARP DATN PHEE LNUL
Joshua Holden (RHIT) Group Theory of Permutation Ciphers 8 / 13
But look:Example
plaintext: thep aper andt hepe nllusecond ciphertext: ETPH EARP DATN PHEE LNUL
This is the same as if you had just used the key(
1 2 3 43 1 4 2
).
The combination of two ciphers is called a product cipher.
In fact: (1 2 3 42 4 3 1
)×(
1 2 3 43 4 2 1
)=
(1 2 3 43 1 4 2
).
NoteNot everyone writes permutation products in the same order, either.
Joshua Holden (RHIT) Group Theory of Permutation Ciphers 9 / 13
Noncommutativity
Note that (1 2 3 42 4 3 1
)×(
1 2 3 43 4 2 1
)is not the same as (
1 2 3 43 4 2 1
)×(
1 2 3 42 4 3 1
).
(I.e., permutation products are not commutative.)
If you don’t believe it, try encrypting our plaintext using the keywordPOEM first and then the keyword TALE.
Joshua Holden (RHIT) Group Theory of Permutation Ciphers 10 / 13
Bad keys
Some ciphers have bad keys — they don’t decrypt properly.
Example(1 2 3 44 1 1 3
)looks like a permutation, but...
plaintext: garb agei ngar bage outx
ciphertext: BGGR IAAE RNNA EBBG XOOTplaintext: 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
Bad keys
Some ciphers have bad keys — they don’t decrypt properly.
Example(1 2 3 44 1 1 3
)looks like a permutation, but...
plaintext: garb agei ngar bage outxciphertext: 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
Bad keys
Some ciphers have bad keys — they don’t decrypt properly.
Example(1 2 3 44 1 1 3
)looks like a permutation, but...
plaintext: garb agei ngar bage outxciphertext: 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
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, andneither are permutation ciphers.
A set which contains a group, but is not a group, because it is notclosed under inverses, i.e. functions.
Joshua Holden (RHIT) Group Theory of Permutation Ciphers 12 / 13
HNAT SOFK LSIR EINT GZXN
NOJET EHYET EMNSG IEOUA
Joshua Holden (RHIT) Group Theory of Permutation Ciphers 13 / 13