Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Comment on

( #3333=superdoc: print w/ replies, xml ) Need Help??

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[$%++]}

In reply to Skytale cipher by chargrill

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • Outside of code tags, you may need to use entities for some characters:
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?
    Username:
    Password:

    What's my password?
    Create A New User
    Chatterbox?
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others wandering the Monastery: (5)
    As of 2014-09-23 03:06 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      How do you remember the number of days in each month?











      Results (210 votes), past polls