Skip to content

Commit dd595c7

Browse files
committed
Improved multiple codecs
1 parent 5b09f0c commit dd595c7

3 files changed

Lines changed: 8 additions & 6 deletions

File tree

codext/crypto/rot.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@
1414

1515
__examples__ = {
1616
'enc(rot0|rot--10|rot100)': None,
17-
'enc(rot1|rot-1|rot_1)': {'this is a test': "uijt jt b uftu"},
18-
'enc(rot3)': {'this is a test': "wklv lv d whvw"},
17+
'enc(rot1|rot-1|caesar_1)': {'this is a test': "uijt jt b uftu"},
18+
'enc(rot3|caesar-3)': {'this is a test': "wklv lv d whvw"},
1919
'enc(rot47)': {'this is a test': "E9:D :D 2 E6DE"},
2020
}
2121
__guess__ = ["rot%d" % i for i in range(1, 26)] + ["rot47"]
@@ -46,5 +46,5 @@ def decode(text, errors="strict"):
4646
return decode
4747

4848

49-
add("rot", rot_encode, rot_decode, r"rot[-_]?([1-9]|1[0-9]|2[0-5]|47)$")
49+
add("rot", rot_encode, rot_decode, r"(?:caesar|rot)[-_]?([1-9]|1[0-9]|2[0-5]|47)$")
5050

docs/enc/binary.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,11 +147,13 @@ This codec rotates N bits using the `>>` (to the right) and `<<` (to the left) o
147147

148148
**Codec** | **Conversions** | **Aliases** | **Comment**
149149
:---: | :---: | --- | ---
150-
`rotate` | text <-> N-bits-rotated text | `rotate-N`, `rotate-right-N`, `rotate_left_N` | N belongs to [1,7] ; when nothing specified, it rotates to the right
150+
`rotate` | text <-> N-bits-rotated text | `rotate-N`, `rotate_bits-N`, `rotate-right-N`, `rotate_left_N` | N belongs to [1,7] ; when nothing specified, it rotates to the right
151151

152152
```python
153153
>>> codext.encode("test", "rotate-1")
154154
':29:'
155+
>>> codext.encode("test", "rotatebits-1")
156+
':29:'
155157
>>> codext.encode("test", "rotate_right-1")
156158
':29:'
157159
>>> codext.encode("test", "rotate_left_1")

docs/enc/crypto.md

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

116116
**Codec** | **Conversions** | **Aliases** | **Comment**
117117
:---: | :---: | --- | ---
118-
`rot` | text <-> rot(1) ciphertext | `rot1`, `rot-1`, `rot_1` |
118+
`rot` | text <-> rot(1) ciphertext | `rot1`, `rot-1`, `rot_1`, `caesar1` |
119119
`rot` | text <-> rot(X) ciphertext | ... |
120-
`rot` | text <-> rot(25) ciphertext | `rot25`, `rot-25`, `rot_25` |
120+
`rot` | text <-> rot(25) ciphertext | `rot25`, `rot-25`, `rot_25`, `caesar25` |
121121

122122
```python
123123
>>> codext.encode("this is a test", "rot-15")

0 commit comments

Comments
 (0)