A slightly less simple obfuscation for a slightly less simple substitution cipher. The next stop in my tour of old forgotten encryption ciphers is this skytale implementation. This either takes a file as a parameter to encrypt in skytale, or provided no input encrypt's it's __DATA__.
#!/usr/bin/perl
open DATA,$ARGV[0]if$ARGV[0];$;=$0=~y~a-z~~;map{m'(\d+)(?{$*=chr$,+65;
+push@{$*},
$^N;$.{$*}++;$,=$,<$;?++$,:0})'}grep!/^10$/,map ord,split//,join'',<DA
+TA>; print
join '' , map chr , @ $_ for 'A' .. ( sort keys ( % . ) ) [ -1 ] ; pr
+int "\n" ;
__DATA__
In cryptography, a scytale (also known as skytale) is a tool used to p
+erform a
transposition cipher, consisting of a cylinder w/ a strip of paper wou
+nd around
it on which is written a message across the windings, with the ciphert
+ext
consisting of the unwound paper. This is one way to implement such a
+cipher.
--chargrill
$,=42;for(34,0,-3,9,-11,11,-17,7,-5){$*.=pack'c'=>$,+=$_}for(reverse s
+plit//=>$*
){$%++?$ %%2?push@C,$_,$":push@c,$_,$":(push@C,$_,$")&&push@c,$"}$C[$#
+C]=$/;($#C
>$#c)?($ c=\@C)&&($ C=\@c):($ c=\@c)&&($C=\@C);$%=$|;for(@$c){print$_^
+$$C[$%++]}
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.