You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
While stronger than the atbash cipher, the affine cipher is still weak because the number of possible keys is way too small: 12 possible values for `a` (needs to be coprime to 26), 26 for `b`, so only 312 different keys. Given a ciphertext, you can write a program that prints all 312 possible plaintexts, one per line, and look at the list to quickly identify the line that looks like English. (This could even be automated using a dictionary.)
79
+
80
+
The affine cipher is an example of a [substitution cipher][sc]; other examples can be found in exercises "simple-cipher", "atbash-cipher", and "rotational-cipher".
81
+
82
+
You can find examples of ciphers based on an different principle, known as [transposition ciphers][tc], in exercises "crypto-square" and "rail-fence-cipher".
83
+
84
+
All of these ciphers are considered toy ciphers by current standards. However, substitution and transposition (also called permutation) are two building blocks of modern ciphers like [AES][aes].
The atbash cipher is weak because there is no secret key: as soon as you know (or guess) that the text has been encrypted with the atbash cipher, you can immediately decrypt it.
32
+
33
+
The atbash cipher is an example of a [substitution cipher][sc]; other examples can be found in exercises "rotational-cipher", "simple-cipher" and "affine-cipher".
34
+
35
+
You can find examples of ciphers based on an different principle, known as [transposition ciphers][tc], in exercises "crypto-square" and "rail-fence-cipher".
36
+
37
+
All of these ciphers are considered toy ciphers by current standards. However, substitution and transposition (also called permutation) are two building blocks of modern ciphers like [AES][aes].
Copy file name to clipboardExpand all lines: exercises/crypto-square/description.md
+12Lines changed: 12 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -69,3 +69,15 @@ Notice that were we to stack these, we could visually decode the ciphertext back
69
69
"aohghn "
70
70
"sseoau "
71
71
```
72
+
73
+
## Perspective
74
+
75
+
This cipher is weak because there is no secret key: as soon as you know (or guess) that the text has been encrypted with this cipher, you can immediately decrypt it.
76
+
77
+
It is an example of a [transposition cipher][tc], like the exercise "rail-fence-cipher". Other exercises, like "rotational-cipher", "simple-cipher", "atbash-cipher" and "affine-cipher", are examples of [substitution ciphers][sc].
78
+
79
+
Substitution and transposition (also called permutation) are two building blocks of modern ciphers such as [AES][aes].
Copy file name to clipboardExpand all lines: exercises/rail-fence-cipher/description.md
+12Lines changed: 12 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -55,3 +55,15 @@ W . . . E . . . C . . . R . . . L . . . T . . . E
55
55
```
56
56
57
57
If you now read along the zig-zag shape you can read the original message.
58
+
59
+
## Perspective
60
+
61
+
This cipher is weak because set the of possible values for the secret key (the number of rails) is very small (no more than the length of the message). Given a message encrypted with the rail fence cipher, you can write a program that tries all possible numbers of rails and prints out all possible plaintexts, one per line. It is then easy to look at the output and identify the line that looks like English. (This could even be automated, for example using a dictionary.)
62
+
63
+
The rail fence cipher is an example of a [transposition cipher][tc], like the exercise "crypto-square". Other exercises, like "rotational-cipher", "simple-cipher", "atbash-cipher" and "affine-cipher", are examples of [substitution ciphers][sc].
64
+
65
+
All of these ciphers are considered toy ciphers by current standards. However, substitution and transposition (also called permutation) are two building blocks of modern ciphers like [AES][aes].
Copy file name to clipboardExpand all lines: exercises/rotational-cipher/description.md
+14Lines changed: 14 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -27,3 +27,17 @@ Ciphertext is written out in the same formatting as the input including spaces a
27
27
- ROT26 `Cool` gives `Cool`
28
28
- ROT13 `The quick brown fox jumps over the lazy dog.` gives `Gur dhvpx oebja sbk whzcf bire gur ynml qbt.`
29
29
- ROT13 `Gur dhvpx oebja sbk whzcf bire gur ynml qbt.` gives `The quick brown fox jumps over the lazy dog.`
30
+
31
+
## Perspective
32
+
33
+
The rotational cipher is very weak because the number of possible keys is way too small. Given a message encrypted with this cipher, you can write a program that prints all 26 possible plaintexts and look at the list to quickly identify the one that looks like English. (This could even be automated, for example using a dictionary.)
34
+
35
+
You can find an improvement over this rotational cipher (also called shift cipher) in the exercise "simple-cipher". Other examples of [substitution ciphers][sc] can be found in exercises "atbash-cipher" and "affine-cipher".
36
+
37
+
You can find examples of ciphers based on an different principle, known as [transposition ciphers][tc], in exercises "crypto-square" and "rail-fence-cipher".
38
+
39
+
All of these ciphers are considered toy ciphers by current standards. However, substitution and transposition (also called permutation) are two building blocks of modern ciphers like [AES][aes].
Copy file name to clipboardExpand all lines: exercises/simple-cipher/description.md
+12-6Lines changed: 12 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -66,13 +66,16 @@ Let's make your substitution cipher a little more fault tolerant by providing a
66
66
67
67
If someone doesn't submit a key at all, generate a truly random key of at least 100 lowercase characters in length.
68
68
69
-
## Extensions
69
+
## Perspective
70
70
71
-
Shift ciphers work by making the text slightly odd, but are vulnerable to frequency analysis.
72
-
Substitution ciphers help that, but are still very vulnerable, especially when the key is short or if spaces are preserved.
73
-
Later on you'll see one an improvement in the exercise "crypto-square".
71
+
Shift ciphers work by making the text slightly odd, but are very weak because
72
+
the number of possible keys is way too small. Given a message encrypted with this cipher, you can write a program that prints all 26 possible plaintexts and look at the list to quickly identify the one that looks like English. This could even be automated, for example using a dictionary, or frequency analysis.
74
73
75
-
However, all of these ciphers are considered toy ciphers by current standards. Modern alternatives include [AES][aes] and [Chacha][chacha].
74
+
Substitution ciphers help that, but are still vulnerable to frequency analysis, especially when the key is short or if spaces are preserved. (Note: the Vigenère Cipher is only one example of a [substitution cipher][sc]; others can be found in exercises "atbash-cipher" and "affine-cipher".)
75
+
76
+
You can find examples of ciphers based on an different principle, known as [transposition ciphers][tc], in exercises "crypto-square" and "rail-fence-cipher".
77
+
78
+
All of these ciphers are considered toy ciphers by current standards. However, substitution and transposition (also called permutation) are two building blocks of modern ciphers like [AES][aes].
76
79
77
80
If you want to go farther in this field, the questions begin to be about how we can exchange keys in a secure way.
78
81
Take a look at [Diffie-Hellman on Wikipedia][dh] for one of the first implementations of this scheme.
@@ -82,7 +85,10 @@ For a solid foundation in modern cryptography, you can check out the [Crypto 101
0 commit comments