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
* Fix Playfair example matrices
* Change Playfair filler letter to X
This matches the Python implementation, the video linked on the page,
and most documentation of the Playfair cipher.
* Clarify duplicate pairs in Playfair
I think this wording is a little clearer when it comes to how double
letter digraphs should be handled.
Co-authored-by: David Leal <halfpacho@gmail.com>
Co-authored-by: Vitor Oliveira <vbrazo@gmail.com>
Copy file name to clipboardExpand all lines: en/Ciphers/playfair-cipher.md
+12-12Lines changed: 12 additions & 12 deletions
Original file line number
Diff line number
Diff line change
@@ -53,21 +53,21 @@ The rules above are used for Encryption. Can be applied vice-versa for Decryptio
53
53
```
54
54
[m o n a r]
55
55
[c h y b d]
56
-
[e f g k i]
56
+
[e f g i k]
57
57
[l p q s t]
58
58
[u v w x z]
59
59
```
60
60
61
-
2. Split the plaintext in digraphs(pair of two). If there is an odd number of letters, a Z is added to the last letter. Pair cannot be made with same letter. Break the letter in single and add a bogus letter to the previous letter.
61
+
2. Split the plaintext in digraphs(pair of two). If there is an odd number of letters, an X is added to the last letter. Pairs cannot be made with same letter. If this occurs, split the pair by adding an X between the duplicate letters.
62
62
63
63
```
64
-
'in' 'st' 'ru' 'me' 'nt' 'sz'
64
+
'in' 'st' 'ru' 'me' 'nt' 'sx'
65
65
```
66
66
67
67
3. Now, we need to follow the rules for encrypting and do as follows:
68
68
69
69
```
70
-
Plain Text: instrumentsz
70
+
Plain Text: instrumentsx
71
71
key: monarchy
72
72
Encryption:
73
73
i -> g
@@ -80,10 +80,10 @@ The rules above are used for Encryption. Can be applied vice-versa for Decryptio
80
80
e -> l
81
81
n -> r
82
82
t -> q
83
-
s -> t
84
-
z -> x
83
+
s -> x
84
+
x -> a
85
85
```
86
-
So we will get the encrypted text as **gatlmzclrqtx**.
86
+
So we will get the encrypted text as **gatlmzclrqxa**.
87
87
88
88
### Decryption
89
89
@@ -92,17 +92,17 @@ So we will get the encrypted text as **gatlmzclrqtx**.
92
92
```
93
93
[m o n a r]
94
94
[c h y b d]
95
-
[e f g k i]
95
+
[e f g i k]
96
96
[l p q s t]
97
97
[u v w x z]
98
98
```
99
99
100
100
2. We need to split the ciphertext as done for plaintext while encrypting
101
101
```
102
-
'ga' 'tl' 'mz' 'cl' 'rq' 'tx'
102
+
'ga' 'tl' 'mz' 'cl' 'rq' 'xa'
103
103
```
104
104
105
-
3. For the previous Cipher Text **gatlmzclrqtx**, by following the rules we get:
105
+
3. For the previous Cipher Text **gatlmzclrqxa**, by following the rules we get:
106
106
107
107
```
108
108
Plain Text: gatlmzclrqtx
@@ -113,9 +113,9 @@ So we will get the encrypted text as **gatlmzclrqtx**.
113
113
mz -> ru
114
114
cl -> me
115
115
rq -> nt
116
-
tx -> sz
116
+
xa -> sx
117
117
```
118
-
So we will get the encrypted text as **instrumentsz**.
118
+
So we will get the encrypted text as **instrumentsx**.
0 commit comments