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!
==Encryption== Each letter is represented by a number [[modular arithmetic|modulo]] 26. Though this is not an essential feature of the cipher, this simple scheme is often used: {| class="wikitable" style="text-align:center; font-size:90%;" ! Letter |A||B||C||D||E||F||G||H||I||J||K||L||M||N||O||P||Q||R||S||T||U||V||W||X||Y||Z |- ! Number |0||1||2||3||4||5||6||7||8||9||10||11||12||13||14||15||16||17||18||19||20||21||22||23||24||25 |} To encrypt a message, each block of ''n'' letters (considered as an ''n''-component [[vector space|vector]]) is multiplied by an [[Invertible matrix|invertible]] ''n'' × ''n'' [[matrix (mathematics)|matrix]], against [[modular arithmetic|modulus]] 26. To decrypt the message, each block is multiplied by the inverse of the matrix used for encryption. The matrix used for encryption is the cipher [[key (cryptography)|key]], and it should be chosen randomly from the set of invertible ''n'' × ''n'' matrices ([[modular arithmetic|modulo]] 26). The cipher can, of course, be adapted to an alphabet with any number of letters; all arithmetic just needs to be done modulo the number of letters instead of modulo 26. Consider the message 'ACT', and the key below (or GYB{{silver (color)|/}}NQK{{silver (color)|/}}URP in letters): :<math>\begin{pmatrix} 6 & 24 & 1 \\ 13 & 16 & 10 \\ 20 & 17 & 15 \end{pmatrix}</math> Since 'A' is 0, 'C' is 2 and 'T' is 19, the message is the vector: :<math>\begin{pmatrix} 0 \\ 2 \\ 19 \end{pmatrix}</math> Thus the enciphered vector is given by: :<math>\begin{pmatrix} 6 & 24 & 1 \\ 13 & 16 & 10 \\ 20 & 17 & 15 \end{pmatrix} \begin{pmatrix} 0 \\ 2 \\ 19 \end{pmatrix} = \begin{pmatrix} 67 \\ 222 \\ 319 \end{pmatrix} \equiv \begin{pmatrix} 15 \\ 14 \\ 7 \end{pmatrix} \pmod{26}</math> which corresponds to a [[ciphertext]] of 'POH'. Now, suppose that our message is instead 'CAT', or: :<math>\begin{pmatrix} 2 \\ 0 \\ 19 \end{pmatrix}</math> This time, the enciphered vector is given by: :<math>\begin{pmatrix} 6 & 24 & 1 \\ 13 & 16 & 10 \\ 20 & 17 & 15 \end{pmatrix} \begin{pmatrix} 2 \\ 0 \\ 19 \end{pmatrix} = \begin{pmatrix} 31 \\ 216 \\ 325 \end{pmatrix} \equiv \begin{pmatrix} 5 \\ 8 \\ 13 \end{pmatrix} \pmod{26}</math> which corresponds to a ciphertext of 'FIN'. Every letter has changed. The Hill cipher has achieved [[Claude Elwood Shannon|Shannon]]'s [[Confusion and diffusion|diffusion]], and an ''n''-dimensional Hill cipher can diffuse fully across ''n'' symbols at once.
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)