Skip to content

Commit dc8a122

Browse files
committed
Add rail fence to docs
1 parent c5b1239 commit dc8a122

2 files changed

Lines changed: 19 additions & 1 deletion

File tree

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,8 @@ o
258258
- [X] `atbash`: aka Atbash Cipher
259259
- [X] `bacon`: aka Baconian Cipher
260260
- [X] `barbie-N`: aka Barbie Typewriter (*N* belongs to [1, 4])
261-
- [X] `citrix`: aka Citrix CTX1 passord encoding
261+
- [X] `citrix`: aka Citrix CTX1 password encoding
262+
- [X] `rail`: aka Rail Fence Cipher
262263
- [X] `rotN`: aka Caesar cipher (*N* belongs to [1,25])
263264
- [X] `scytaleN`: encrypts using the number of letters on the rod (*N* belongs to [1,[)
264265
- [X] `shiftN`: shift ordinals (*N* belongs to [1,255])

docs/enc/crypto.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,23 @@ This implements the Citrix CTX1 password encoding algorithm.
128128

129129
-----
130130

131+
### Rail Fence Cipher
132+
133+
This implements the Rail Fence encoding algorithm.
134+
135+
**Codec** | **Conversions** | **Aliases** | **Comment**
136+
:---: | :---: | --- | ---
137+
`rail` | text <-> rail fence ciphertext, X rails and Y offset | `rail-X-Y`, `rail_X_Y`| The encoding fence is built from the top. Careful to trailing whitespaces.
138+
`railup` | text <-> rail fence ciphertext, X rails and Y offset | `railup-X-Y`, `railup_X_Y`| The encoding fence is built from the bottom. Inverted compaired to the `rail` codec.
139+
140+
```python
141+
>>> codext.encode("this is a test", "rail-5-3")
142+
'it sss etiath '
143+
>>> codext.decode("it sss etiath ", "rail-5-3")
144+
'this is a test'
145+
```
146+
147+
-----
131148
### ROT N
132149

133150
This is a dynamic encoding, that is, it can be called with an integer to define the ROT offset. Encoding will apply a positive offset, decoding will apply a negative one.

0 commit comments

Comments
 (0)