Hi, I found your obfuscation nice and I was asking myself why it should be so simple and easy to understand. So I treated it permutationally and I propose the following de-obfuscation. It does not look much clearer unfortunately.

There's a little problem in this code too: the seed for translation (right shift $tran=6012345) is not in itself obtained permutationally.

P.S. the script should print:

another--<-> ranothe--r<->anothe hranote--h<->ranot ohrante--o<->hran aohrnte--a<->ohr haornte--h<->ao ahornte--a<->h ahornte
#!/usr/bin/perl $_=q qanotherq, my $l=length; while($l){s/(.{$l})(.)/$2$1/;--$l; print+$_."--".$2."<->".$1."\n"}; ## De-obfuscation: print &deobf("another")."\n"; sub deobf { my $n = 0; my (@tran,$res); my %h = map { $n++ => $_ } (split //,shift); while ($n > 0) { $n--; $res = $n.$res ; } $tran = $res; $tran =~ s/(.+)(.{1})/$2$1/; ## The shift seed. ## print "tran: $tran\n"; for ($n = 0; $n < length($res)-1; $n++) { $res = &comp(&perm($tran,$res),$n) } return join('',map{ $h{$_} } (split //,$res)); } ## END deobf() sub perm { my ($target,$agent) = @_; ## Max. base (string length) = 10. my @targ = split //,$target;## Digital permutations only.. my @perm = split //,$agent; ## e.g. 021, 3102, etc.. my $res; ## but not 031, 123, ... nor 0123456789A,.. for (my $i = 0; $i < (@perm); $i++){ $res .= $perm[$targ[$i]] } return $res; } ## END perm() sub comp { my ($res, $pos) = @_; if ($pos > 0){ my @perm = split //,$res; my $l = scalar(@perm); my $p1a = $perm[0]; my $p1b = $perm[$l-$pos]; $perm[0] = $p1b; $perm[$l-$pos] = $p1a; for (my $n = 0; $n < $pos; $n++){ my $p2a = $perm[$l-1]; my $p2b = $perm[$l-$n-1]; $perm[$l-1] = $p2b; $perm[$l-$n-1] = $p2a; } $res = join '', @perm; } return $res; } ## END comp() 1;

In reply to Re: Length obfuscation by emilbarton
in thread Length obfuscation by trizen

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!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • 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, details, 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, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            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.