change wording slightly

This commit is contained in:
filifa 2025-07-20 19:14:39 -04:00
parent 0773e06401
commit 923e47c83b
1 changed files with 2 additions and 2 deletions

View File

@ -60,7 +60,7 @@
"## Vigenère cipher\n",
"What makes the Vigenère cipher trickier is that it's possible that two instances of the same character get XORed with *different* characters from the key, resulting in two distinct bytes in the ciphertext. This causes the distribution of characters in the ciphertext to change from the plaintext, so a direct frequency analysis is ineffective. However, if we're a bit more clever, we can still apply frequency analysis.\n",
"\n",
"The first step is to determine the likely length of the key. Fortunately for us, this was already given as 3 in the problem, but there are techniques for deducing the key length yourself, too, such as Kasiski elimination or the Friedman test.\n",
"The first step is to determine the likely length of the key. Fortunately for us, this was already given as 3 in the problem, but there are techniques for deducing the key length yourself, too, such as Kasiski examination or the Friedman test.\n",
"\n",
"Since the key length is 3, we know that the 0th, 3rd, 6th, ... characters were all XORed with the same byte - likewise for the 1st, 4th, 7th, ... and 2nd, 5th, 8th, ... characters. In other words, each batch of characters was encrypted with a *separate Caesar cipher*. This means we can find each character of the overall key by just applying frequency analysis on each batch separately.\n",
"\n",
@ -106,7 +106,7 @@
"id": "2c2e0417",
"metadata": {},
"source": [
"We then just iterate through all our possible keys and try decrypting with each key to see if we get something sensible. Since our technique of breaking each Caesar cipher is probabilistic, it's possible in the general case that we have to try multiple keys, if it turns out that the space character is not the most common character in one or more of our batches.\n",
"We can then iterate through all our possible keys and try decrypting with each key to see if we get something sensible. Since our technique of breaking each Caesar cipher is probabilistic, it's possible in the general case that we have to try multiple keys, if it turns out that the space character is not the most common character in one or more of our batches.\n",
"\n",
"Fortunately for us, the first key we generate ends up being the one we're looking for."
]