Skip to main content

Subsection 3.4 Affine ciphers

At this stage, you may introduce affine ciphers, a natural generalization of shift ciphers. We’ve described the shift cipher as a function \(f(p)\equiv p+k\mod26\text{.}\) Note that this is simply a linear function with slope \(1\) and \(y\)-intercept \(k\text{.}\) But there is no requirement that ciphers stick to a slope of \(1\text{;}\) the affine cipher first multiplies the plaintext letter by a certain amount \(m\text{,}\) then adds a constant amount \(k\text{.}\) Its equation is
\begin{equation*} c:=f(p)\equiv mp+k\mod26.\label{KI-eq:affine-cipher} \end{equation*}
Here \(m\) is called the multiplicative key and \(k\) the additive key. (We do not call these “linear ciphers” to avoid confusion with the notion of “linear” students may see in the future when studying linear transformations and homomorphisms.)
5.
  1. Have students create two or three plaintext messages and pair each message with any value of \(k\) and a value of \(m\) such that \(\gcd(m,26)=1\text{.}\) Then encrypt each message using the affine cipher with that multiplicative and additive key.
  2. Pass your resulting ciphertexts clockwise in your group without sharing the values of \(m\) and \(k\text{.}\) What are your thoughts as you attempt to decrypt this ciphertext? (Note that students will likely be unable to decrypt affine ciphertext at this stage, but the resulting considerations may lead them down a fruitful path. We will discuss an algorithm for decrypting affine ciphers in the following section.)