http://www.perlmonks.org?node_id=547337


in reply to Skytale cipher

Good Implementation :-) ...

Your scitale has a width (W) denoted by the number of lower cups characters the filename has, plus one.

Then, you use W arrays for storing each character from the plaintext; first character on the plaintext to the array[0], the second to the array1, and so on up to reach the arrayW-1, the next char to the first array[0], etc.

Cool!, i've made an implementation of this cipher (i like too much these topic) a long time ago (i do not remember where did i put it), but for sure my impl. was unobfuscated an i think i made W reads of the plaintext for encoding and decoding. Not too optimal, but easy to understand :-) (ummm... i don't rememeber if i've made it in perl ... or it was in awk? ... anyway)

perl -Te 'print map { chr((ord)-((10,20,2,7)[$i++])) } split //,"turo"'