Skip to content

Commit f5bf1fd

Browse files
authored
Revise cryptographic ciphers documentation in crypto.md
Updated the documentation for various cryptographic ciphers implemented in `codext`, including details on encoding, parameters, and examples for each cipher.
1 parent dd4e923 commit f5bf1fd

1 file changed

Lines changed: 60 additions & 0 deletions

File tree

docs/pages/enc/crypto.md

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -276,6 +276,66 @@ The Playfair cipher is a symmetric encryption method using polygram substitution
276276

277277
-----
278278

279+
### Trithemius Cipher
280+
281+
This is a variant of the [Vigenere Cipher](#vigenere-cipher) with key `"ABCDEFGHIJKLMNOPQRSTUVWXYZ"`.
282+
283+
**Codec** | **Conversions** | **Aliases** | **Comment**
284+
:---: | :---: | --- | ---
285+
`trithemius` | text <-> Trithemius ciphertext | `trithemius`, `trithemius_cipher` |
286+
287+
```python
288+
>>> codext.encode("This is a test !", "trithemius")
289+
'Tikv mx g ambd !'
290+
>>> codext.decode("Tikv mx g ambd !", "trithemius")
291+
'This is a test !'
292+
```
293+
294+
-----
295+
296+
### VIC Cipher
297+
298+
The VIC cipher combines a straddling checkerboard substitution (converting letters to a stream of digits) and an over-encryption based on a modulo-10 sum with eventually a conversion from digits to text.
299+
300+
**Codec** | **Conversions** | **Aliases** | **Comment**
301+
:---: | :---: | --- | ---
302+
`vic` | text <-> VIC digit/text ciphertext | `vic-keyword`, `vic-key-12`, `vic-^-26-0248`, `vic-*-73-534T` | optional checkerboard keyword or alphabet marker, blank positions (exactly 2 distinct digits), over-encryption key (digits), "`T`" marker for text conversion
303+
304+
Alphabet markers:
305+
- `*`: uses "`ABC[...]XYZ./`" (uppercase letters + "`./`")
306+
- `^`: uses "`./ZYX[...]CBA`" ("`./`" + reversed uppercase letters)
307+
308+
```python
309+
>>> import codext
310+
>>> codext.encode("VICTOR", "vic-^-26-0248T")
311+
'VVXYWYY.XYJ'
312+
>>> codext.decode("VVXYWYY.XYJ", "vic-^-26-0248T")
313+
'VICTOR2' # trailing superfluous letter because of text conversion
314+
>>> codext.encode("LONGTESTSTRING", "vic-^-85-72564")
315+
'5031237844273727064454072378'
316+
```
317+
318+
-----
319+
320+
### Vigenere Cipher
321+
322+
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_.
323+
324+
**Codec** | **Conversions** | **Aliases** | **Comment**
325+
:---: | :---: | --- | ---
326+
`vigenere` | text <-> Vigenere ciphertext | `vigenere-abcdef`, `vigenere_MySuperSecret` | key only consists of characters, not digits
327+
328+
```python
329+
>>> codext.encode("This is a test !", "vigenere-abababa")
330+
'Tiit it a tfsu !'
331+
>>> codext.encode("This is a test !", "vigenere_MySuperSecret")
332+
'Ffam xw r liuk !'
333+
>>> codext.decode("Tiit it a tfsu !", "vigenere-abababa")
334+
'This is a test !'
335+
```
336+
337+
-----
338+
279339
### XOR with 1 byte
280340

281341
This is a dynamic encoding, that is, it can be called with an integer to define the ordinal of the byte to XOR with the input text.

0 commit comments

Comments
 (0)