Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Hill cipher
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
==Example== Let :<math>K= \begin{pmatrix} 3 & 3 \\ 2 & 5 \end{pmatrix}</math> be the key and suppose the plaintext message is 'HELP'. Then this plaintext is represented by two pairs :<math>HELP \to \begin{pmatrix} H \\ E \end{pmatrix} , \begin{pmatrix} L \\ P \end{pmatrix} \to \begin{pmatrix} 7 \\ 4 \end{pmatrix} , \begin{pmatrix} 11 \\ 15 \end{pmatrix}</math> Then we compute :<math>\begin{pmatrix} 3 & 3 \\ 2 & 5 \end{pmatrix} \begin{pmatrix} 7 \\ 4 \end{pmatrix} \equiv \begin{pmatrix} 7 \\ 8 \end{pmatrix} \pmod{26},</math> and :<math>\begin{pmatrix} 3 & 3 \\ 2 & 5 \end{pmatrix} \begin{pmatrix} 11 \\ 15 \end{pmatrix} \equiv \begin{pmatrix} 0 \\ 19 \end{pmatrix}\pmod{26}</math> and continue encryption as follows: :<math>\begin{pmatrix} 7 \\ 8 \end{pmatrix}, \begin{pmatrix} 0 \\ 19 \end{pmatrix} \to \begin{pmatrix} H \\ I \end{pmatrix}, \begin{pmatrix} A \\ T \end{pmatrix}</math> The matrix ''K'' is invertible, hence <math>K^{-1}</math> exists such that <math>KK^{-1}=K^{-1}K=I_2</math>. The inverse of ''K'' can be computed by using the [[Invertible matrix#Inversion of 2Γ2 matrices|formula]] <math>\begin{pmatrix} a & b \\ c & d \end{pmatrix}^{-1}=(ad-bc)^{-1}\begin{pmatrix} d & -b \\ -c & a \end{pmatrix}</math> This formula still holds after a modular reduction if a [[modular multiplicative inverse]] is used to compute {{nowrap|<math>(ad-bc)^{-1}</math>.}} Hence in this case, we compute :<math>K^{-1} \equiv 9^{-1} \begin{pmatrix} 5 & 23 \\ 24 & 3 \end{pmatrix} \equiv 3 \begin{pmatrix} 5 & 23 \\ 24 & 3 \end{pmatrix} \equiv \begin{pmatrix} 15 & 17 \\ 20 & 9 \end{pmatrix}\pmod{26}</math> :<math>HIAT \to \begin{pmatrix} H \\ I \end{pmatrix}, \begin{pmatrix} A \\ T \end{pmatrix} \to \begin{pmatrix} 7 \\ 8 \end{pmatrix}, \begin{pmatrix} 0 \\ 19 \end{pmatrix}</math> Then we compute :<math>\begin{pmatrix} 15 & 17 \\ 20 & 9 \end{pmatrix}\begin{pmatrix} 7 \\ 8 \end{pmatrix} = \begin{pmatrix} 241 \\ 212 \end{pmatrix} \equiv \begin{pmatrix} 7 \\ 4 \end{pmatrix}\pmod{26},</math> and :<math>\begin{pmatrix} 15 & 17 \\ 20 & 9 \end{pmatrix}\begin{pmatrix} 0 \\ 19 \end{pmatrix} = \begin{pmatrix} 323 \\ 171 \end{pmatrix} \equiv \begin{pmatrix} 11 \\ 15 \end{pmatrix}\pmod{26}</math> Therefore, :<math>\begin{pmatrix} 7 \\ 4 \end{pmatrix}, \begin{pmatrix} 11 \\ 15 \end{pmatrix} \to \begin{pmatrix} H \\ E \end{pmatrix}, \begin{pmatrix} L \\ P \end{pmatrix} \to HELP</math>.
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)