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

A simple play with numbers, and function calls.

My first intentions were different, but I had trouble with big numbers not fitting inside Integer, so this will do for now.

A(split//, join'', map {qq|$_@{[ord(A)+(map-100+ord,split//, 'mdsk')[$.++]]}3|}map{344+((1,-1,-1,1)[$o++]*ord( 'd')*($i++ ==3?5:1))+ord}split//,'Codz');sub A{$_[0]&&do{($_[0]!=$_[1]) &&shift and&A||do{shift;shift;$_=$|; {$_*=10;$_+=shift;$_[0] ==3||redo}print chr,chr(1+15*shift);&A;}}}s,,$i++*$o+ord,ex;

He who asks will be a fool for five minutes, but he who doesn't ask will remain a fool for life.
Chady | http://chady.net/
Are you a Linux user in Lebanon? join the Lebanese Linux User Group.

Replies are listed 'Best First'.
Re: untitled obfu
by jdalbec (Deacon) on Jan 08, 2005 at 16:48 UTC
    # Analysis phase 1 print join ' ', map { 344 + ( ( 1, -1, -1, 1 )[ $o++ ] * ord('d') * ( $i++ == 3 ? 5 +: 1 ) ) + # ord('d') == 100 doesn't affect last two digits ord } split //, 'Codz'; # 'C' -> 11, 'N' -> 22, 'Y' -> 33, 'd' -> 44, 'o' -> 55, 'z' -> 66, # '!' -> 77, ',' -> 88, '7' -> 99, '8' -> 00 (if > 0) # '-' -> 11, '"' -> 22, '{' -> 33, 'p' -> 44, 'e' -> 55, 'Z' -> 66, # 'O' -> 77, 'D' -> 88, '9' -> 99, '8' -> 00 (if < 0 - doesn't happen +here) print "\n"; undef $o; undef $i; # clean up # 511 355 344 966 # ^^ ^^ ^^ ^^ last two digits ==, first digit != second # could have more digits as long as only last pair == e.g. -1211 # Analysis phase 2 print join ' ', map { qq|$_@{[ord(A)+(map-100+ord,split//, 'mdsk')[$.++]]}3| # 100 == ord('d') so 'd' -> 'A' # mdsk -> lcrj -> kbqi -> JAPH (another Caesar cipher!) } map { 344 + ( ( 1, -1, -1, 1 )[ $o++ ] * ord('d') * ( $i++ == 3 ? 5 +: 1 ) ) + ord } split //, 'Codz'; print "\n"; undef $o; undef $i; undef $.; # clean up # 511743 355653 344803 966723 # ^^^ ^^^ ^^^ ^^^ first 3 digits same as above # ^^ ^^ ^^ ^^ JAPH # ^ ^ ^ ^ last digit == 3 # Analysis phase 3 (++perltidy!) A( split //, join '', map { qq|$_@{[ord(A)+(map-100+ord,split//, 'mdsk')[$.++]]}3| } map { 344 + ( ( 1, -1, -1, 1 )[ $o++ ] * ord('d') * ( $i++ == 3 ? 5 +: 1 ) ) + ord } split //, 'Codz' ); # The argument list of A is actually # split / */, '511743 355653 344803 966723' # but since A restarts after each number # (the final 3 is a "stop digit") # I'll keep them separate in the comments below. # The stop digit had to be 1, 3, or 9 # since 0, 2, 4, 5, 6, 7, and 8 all appear # among the digits of the ASCII values of 'JAPH'. sub A { $_[0] && do { ( $_[0] != $_[1] ) && shift # skip leading garbage # 511743 355653 344803 966723 -> 11743 55653 44803 66723 and &A || do { shift; shift; # skip leading garbage # 11743 55653 44803 66723 -> 743 653 803 723 $_ = $|; # $| has to be 0 so don't unbuffer STDOUT { $_ *= 10; $_ += shift; $_[0] == 3 || redo } # $_ = 74 65 80 72 = 'J' 'A' 'P' 'H' print chr, chr( 1 + 15 * shift ); # 1 + 15 * 3 = 46 = '.' &A; # process next number } } } s,,$i++*$o+ord,ex; # misdirection - changes $_ from 72 to 7172 (71 = 4*4+ord('7'))