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!
===Key elimination=== The Vigenère cipher, with normal alphabets, essentially uses modulo arithmetic, which is commutative. Therefore, if the key length is known (or guessed), subtracting the cipher text from itself, offset by the key length, will produce the plain text subtracted from itself, also offset by the key length. If any "probable word" in the plain text is known or can be guessed, its self-subtraction can be recognized, which allows recovery of the key by subtracting the known plaintext from the cipher text. Key elimination is especially useful against short messages. For example, using <code>LION</code> as the key below: {| | Plaintext: || <code>thequickbrownfoxjumpsoverthelazydog</code> |- | Key: || <code>LIONLIONLIONLIONLIONLIONLIONLIONLIO</code> |- | Ciphertext: || <code>EPSDFQQXMZCJYNCKUCACDWJRCBVRWINLOWU</code> |} Then subtract the ciphertext from itself with a shift of the key length 4 for <code>LION</code>. {| | Ciphertext (original): || <code>'''EPSD'''FQQXMZCJYNCKUCACDWJRCBVRWINLOWU</code> |- | Ciphertext (shifted): || <code>FQQXMZCJYNCKUCACDWJRCBVRWINLOWU____</code> |- | Result (difference): || <code>ZZCGTROOOMAZELCIRGRLBVOAGTIGIMT{{strikethrough|LOWU}}</code> |} Which is nearly equivalent to subtracting the plaintext from itself by the same shift. {| | Plaintext (original): || <code>'''theq'''uickbrownfoxjumpsoverthelazydog</code> |- | Plaintext (shifted): || <code>uickbrownfoxjumpsoverthelazydog____</code> |- | Result (difference): || <code>zzcgtrooomazelcirgrlbvoagtigimt{{strikethrough|ydog}}</code> |} Which is algebraically represented for <math>i \in [1, n - m]</math> as: :<math> \begin{align} (C_i - C_{(i + m)}) \bmod \ell &= (E_K(M_i) - E_K(M_{(i + m)})) \bmod \ell \\ &= ((M_i + K_{(i \bmod m)}) \bmod \ell - (M_{(i + m)} + K_{((i + m) \bmod m)}) \bmod \ell) \bmod \ell \\ &= ((M_i + K_{(i \bmod m)}) - (M_{(i + m)} + K_{((i + m) \bmod m)})) \bmod \ell \\ &= (M_i + K_{(i \bmod m)} - M_{(i + m)} - K_{((i + m) \bmod m)}) \bmod \ell \\ &= (M_i - M_{(i + m)} + K_{(i \bmod m)} - K_{((i + m) \bmod m)}) \bmod \ell \\ &= (M_i - M_{(i + m)} + K_{(i \bmod m)} - K_{(i \bmod m)}) \bmod \ell \\ &= (M_i - M_{(i + m)}) \bmod \ell \\ \end{align}</math> In this example, the words <code>brownfox</code> are known. {| | Plaintext (original): || <code>brownfox</code> |- | Plaintext (shifted): || <code>nfox____</code> |- | Result (difference): || <code>omaz{{strikethrough|nfox}}</code> |} This result <code>omaz</code> corresponds with the 9th through 12th letters in the result of the larger examples above. The known section and its location is verified. Subtract <code>brow</code> from that range of the ciphertext. {| | Ciphertext: || <code>EPSDFQQX'''MZCJ'''YNCKUCACDWJRCBVRWINLOWU</code> |- | Plaintext: || <code>________brow_______________________</code> |- | Key: || <code>{{strikethrough|EPSDFQQX}}'''LION'''{{strikethrough|YNCKUCACDWJRCBVRWINLOWU}}</code> |} This produces the final result, the reveal of the key <code>LION</code>.
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)