Skip to content

Commit a27258b

Browse files
authored
Remove Vigenere additions and document Playfair codec
1 parent 0164479 commit a27258b

4 files changed

Lines changed: 10 additions & 77 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -285,12 +285,12 @@ This category also contains `ascii85`, `adobe`, `[x]btoa`, `zeromq` with the `ba
285285
- [X] `bacon`: aka Baconian Cipher
286286
- [X] `barbie-N`: aka Barbie Typewriter (*N* belongs to [1, 4])
287287
- [X] `citrix`: aka Citrix CTX1 password encoding
288+
- [X] `playfair`: aka Playfair Cipher
288289
- [X] `polybius`: aka Polybius Square Cipher
289290
- [X] `railfence`: aka Rail Fence Cipher
290291
- [X] `rotN`: aka Caesar cipher (*N* belongs to [1,25])
291292
- [X] `scytaleN`: encrypts using the number of letters on the rod (*N* belongs to [1,[)
292293
- [X] `shiftN`: shift ordinals (*N* belongs to [1,255])
293-
- [X] `vigenere`: aka Vigenere Cipher
294294
- [X] `xorN`: XOR with a single byte (*N* belongs to [1,255])
295295

296296
> :warning: Crypto functions are of course definitely **NOT** encoding functions ; they are implemented for leveraging the `.encode(...)` API from `codecs`.

docs/pages/enc/crypto.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -202,20 +202,21 @@ This is a dynamic encoding, that is, it can be called with an integer to define
202202

203203
-----
204204

205-
### Vigenere Cipher
205+
### Playfair Cipher
206206

207-
This is a dynamic encoding, that is, it holds the key. There is no default key, meaning that `vigenere` as the encoding scheme throws a `LookupError` indicating that the _key must be a non-empty alphabetic string_.
207+
The Playfair cipher is a symmetric encryption method using polygram substitution with bigrams (pairs of letters), invented in 1854 by Charles Wheatstone, but popularized by Lord Playfair.
208208

209209
**Codec** | **Conversions** | **Aliases** | **Comment**
210210
:---: | :---: | --- | ---
211-
`vigenere` | text <-> Vigenere ciphertext | `vigenere-abcdef`, `vigenere_MySuperSecret` | key only consists of characters, not digits
211+
`playfair` | text <-> Playfair ciphertext | `playfair`, `playfair-playfairexample`, `playfair-keyword` | Dynamic key parameter ; letters only ; `J` is normalized to `I`
212212

213213
```python
214-
>>> codext.encode("This is a test !", "vigenere-abababa")
215-
'Tiit it a tfsu !'
216-
>>> codext.encode("This is a test !", "vigenere_MySuperSecret")
217-
'Ffam xw r liuk !'
218-
>>> codext.decode("Tiit it a tfsu !", "vigenere-abababa")
214+
>>> codext.encode("HIDETHEGOLDINTHETREESTUMP", "playfair-playfairexample")
215+
'BMODZBXDNABEKUDMUIXMMOUVIF'
216+
>>> codext.decode("BMODZBXDNABEKUDMUIXMMOUVIF", "playfair-playfairexample")
217+
'HIDETHEGOLDINTHETREXESTUMP'
218+
>>> codext.decode(codext.encode("INSTRUMENT", "playfair-keyword"), "playfair-keyword")
219+
'INSTRUMENT'
219220
```
220221

221222
-----
@@ -238,4 +239,3 @@ This is a dynamic encoding, that is, it can be called with an integer to define
238239
>>> codext.encode("~bcy*cy*k*~oy~", "xor-10")
239240
'this is a test'
240241
```
241-

src/codext/crypto/__init__.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,4 @@
1010
from .rot import *
1111
from .scytale import *
1212
from .shift import *
13-
from .vigenere import *
1413
from .xor import *
15-

src/codext/crypto/vigenere.py

Lines changed: 0 additions & 65 deletions
This file was deleted.

0 commit comments

Comments
 (0)