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
Vigenère 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!
== Algebraic description == Vigenère can also be described algebraically. If the letters <code>A</code>–<code>Z</code> are taken to be the numbers 0–25 (<math>A \,\widehat{=}\, 0</math>, <math>B \,\widehat{=}\, 1</math>, etc.), and addition is performed [[modular arithmetic|modulo]] 26, Vigenère encryption <math>E</math> using the key <math>K</math> can be written as :<math>C_i = E_K(M_i) = (M_i+K_i) \bmod 26</math> and decryption <math>D</math> using the key <math>K</math> as :<math>M_i = D_K(C_i) = (C_i-K_i) \bmod 26,</math> in which <math>M = M_1 \dots M_n</math> is the message, <math>C = C_1 \dots C_n</math> is the ciphertext and <math>K = K_1 \dots K_n</math> is the key obtained by repeating the keyword <math>\lceil n / m \rceil</math> times in which <math>m</math> is the keyword length. Thus, by using the previous example, to encrypt <math>A \,\widehat{=}\, 0</math> with key letter <math>L \,\widehat{=}\, 11</math> the calculation would result in <math>11 \,\widehat{=}\, L</math>. :<math>11 = (0+11) \bmod 26</math> Therefore, to decrypt <math>R \,\widehat{=}\, 17</math> with key letter <math>E \,\widehat{=}\, 4</math>, the calculation would result in <math>13 \,\widehat{=}\, N</math>. :<math>13 = (17-4) \bmod 26</math> In general, if <math>\Sigma</math> is the alphabet of length <math>\ell</math>, and <math>m</math> is the length of key, Vigenère encryption and decryption can be written: :<math>C_i = E_K(M_i) = (M_i+K_{(i \bmod m)}) \bmod \ell,</math> :<math>M_i = D_K(C_i) = (C_i-K_{(i \bmod m)}) \bmod \ell.</math> <math>M_i</math> denotes the offset of the ''i''-th character of the plaintext <math>M</math> in the alphabet <math>\Sigma</math>. For example, by taking the 26 English characters as the alphabet <math>\Sigma = (A,B,C,\ldots,X,Y,Z)</math>, the offset of A is 0, the offset of B is 1 etc. <math>C_i</math> and <math>K_i</math> are similar.
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)