Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Obfuscated code

( [id://1597]=superdoc: print w/replies, xml ) Need Help??

Got some code which would take a Perl grand master to understand without running it? Post it in this section so we can stare at it in awe.

Word of warning, though: Don't be too cocky with your post — almost inevitably someone will post a reply that does the exact same thing in even fewer characters!

New Less than Readable Code
Map coordinates?
3 direct replies — Read more / Contribute
by Anonymous Monk
on Sep 02, 2019 at 12:36

    Hey Perl wizards. Any thoughts on what this translates to? TIA

    @t = map{$_ *($_+($_-1))% 4}(2, 3, 4);$i=chr(0x34);$five=chr(55);print +"$i$five ".(@t[0]+@t[1]).($i/2).".".@t[0].chr(0x35).(@t[0]*3+1)."\n"; + @x= map{(srand(1)*$_)%9}(28,34,57);print @x[0].(@x[0]*2).(@x[0]*2*2/ +2)." ".chr(48).(@x[2]*3).".".(@x[2]+1).chr(0x30).((@x[1]%4)-3)."\n";
Just another JAPH
3 direct replies — Read more / Contribute
by k-mx
on Sep 01, 2019 at 08:53
    Hello! Here is my JAPH. Not very cryptic, I just want to say it:
    #!/usr/bin/env perl use 5.026.1; no strict; format = . BEGIN { use SelfLoader; open *q, v60 , $0; s(.*)((<q>)[-1])e; open DATA, '<', \s( \S+ (?{ \&{$&} }) )( sub $& { \@_ = ( $& => \@_ ) and !wantarray ? formline<<~"\@_" : \@_ \@_, \@_ })rgx } END { write or die } Just another Perl hacker,
Stamp puzzle solution
2 direct replies — Read more / Contribute
by drpaz
on Jun 07, 2019 at 13:20

    Someone posted this challenge at work..
    The country of Elbonia is standardizing its postal system to streamline its parcel service. All parcel boxes (many sizes available) now come with 10 preprinted rectangles on one side for stamps to be stuck into. Elbonia's stamp denominations are:
    1c, 2c, 3c, 4c, 5c, 10c, 24c, 37c, 39c, 41c, 48c, 60c, 63c, 70c, 75c, 80c, 83c, 84c, 87c, $1, $3.85, $4.05, $4.60, $5, $14.40
    Given an infinite supply of each denomination, what is the minimum postage amount that would REQUIRE 11 stamps and so not work with the streamlined service?

    my$w={0=>1,1=>1,2=>2,3=>3,4=>4,5=>5,10=> 10,24=>24,37=>37,39=>39,41=>41,48=>48,60 =>60 ,63=> 63, 70=> 70,75 =>75 ,80=>80 ,83=> 83, 84=>84,87=>87, 100=> 100, 385=>385,405=>405 ,460=> 460 ,500=>500,1440=> 1440}; my@a =sort{$a<=>$b}keys %{$w}; for( 1..9){foreach my$c (keys %{$w} ){foreach my $v(@a) {my $n =$c+ $v;if(!exists$w-> {$n}) {$w ->{$n}=$w->{$c}. "+".$v ;}}} }my@r=sort{$a<=> $b}keys %{$w };my$h=pop@r; for my$i (0.. $h){if(exists $w->{$ i}){ print"$ i->". $w-> {$i}."\n" ;}### else{ print"!$i \n";} }### # ########## ##### #### # ############ ##### #### # ############## ##### #### # ################ ##### #### ################### ##### #### ############## ##### #### ## ## ######################################## ##### # ########### ############## ##### ########################################
room 237 JAPH
No replies — Read more | Post response
by Discipulus
on Mar 08, 2019 at 08:02
    NB: minimum console width 108

    THE : OVERLOOK: MAZE: $} = pack ('H*' ,'416c6c20776f726b20616e64206e6f20706c6179206d616b6573204a61636b206120 +64756c6c20626f79' ## #### #### #### #### ####### #### ### +# #### #### ## );for((1,1,1,1,0)x 4,(0,2,4,6,8)x 4,(0,8,6,4,2) x 4,'ll',(1,1,1,1,0),' +\sand',(1,1,1,1,0 ## #### #### #### #### #### #### ### +# #### #### ## ),'\sno',(1,1,1,1,0),'\sp\Klay',(1,1,1,1,0),'\sdu',(1,1,1,1,0),'ll',(1 +,1,1,1,0),'a.boy' ## #### #### #### #### ####### #### #### #### + #### ## ,(1,1,1,1,0),(0,0,1,1,1,1,1)x 4,'\swork',(1,1,1,1,0),'\swith',(1,1,1,1 +,0),'\smakes',(1, 1,1,1,0)x 4,'a',(1,1,1,1,0),((join'|',split'','perl'),1,$",1)x 4,(1,1, +1,1,0)x 4,){ ($}= ## #### #### #### #### #### #### ### +# #### #### ## $}) =~ s/^(A)(.)(.)(.)$/ $3$1$2$4/ or$}=~/a boy/?($}=$})=~s/a\Kck/pH/: +'' or( ($X=$^X)=~ s/.*\W(.{4})\.?.{0,3}$/ucfirst($1)/e and($}=$})=~s/\bp\b/with $X/) or +print/\D/?($}=$}) ## #### #### #### #### #### ### +# #### #### ## # #### #### #### #### #### #### + #### # # #### #### # JAPH # + #### #### # # #### #### #### #### #### #### + #### # ## #### #### #### #### #### ### +# #### #### ## =~s/$_//&&sleep 1&&next:($_?$"x((80-length$} x 2)/2+$_):$/.$".$".$" x( +(80-length$} x 2) /2+$_)),$" x $_,$},$" x 5,$},$/;select undef,undef,undef,0.3;}print$/. +$/;for $_237(4,3, ## #### #### #### #### ####### #### #### #### + #### ## 2,1,1,1,0,0,0,0,0){$redroom =$} eq $redroom?' 237':$}; for(121118033,7 +7833563,77899093, 119840081,78947665,77899089,77899089,79406545,){print +(map{$_>0?$redr +oom:$".$".$".$"}( ## #### #### #### #### ####### #### ### +# #### #### ## split'',sprintf("%b", $_))),$/;select undef,undef,undef,0.3;print$/ x +$_237;}print$/.$/ ## #### #### #### #### #### #### ### +# #### #### ## .$/;select undef,undef,undef,1;}for(60649,21161,21161,21161,24303,8666 +5,86665,119433,){ ## #### #### #### #### ####### #### ### +# #### #### ## print +(map{$_>0? $redroom:$".$".$".$"}(split'',sprintf("%021b",$_))), +$/;}print $/ x 10

    L*

    There are no rules, there are no thumbs..
    Reinvent the wheel, then learn The Wheel; may be one day you reinvent one of THE WHEELS.
lost : in : keywords
No replies — Read more | Post response
by Discipulus
on Feb 24, 2019 at 06:32
    die:abs:accept:alarm:atan2:bind:binmode:join:bless:caller:chdir:chmod: chomp:chop:chown:chr:chroot:pos:print:printf:prototype:push:quotemeta: close:closedir:connect:cos:last:crypt:dbmclose:dbmopen:defined:delete: die:dump:each:endgrent:last:endhostent:endnetent:endprotoent:endpwent: endservent:eof:eval:exec:exists:exit:exp:extern:fc:fcntl:fileno:flock: fork:format:formline:getc:or:getgrent:getgrgid:getgrnam:gethostbyaddr: gethostbyname:and:gethostent:or:getlogin:getnetbyaddr:or:getnetbyname: getnetent:getpeername:last:getpgrp:getppid:getpriority:getprotobyname: getprotobynumber:getprotoent:getpwent:getpwnam:getpwuid:getservbyname: getservbyport:and:getservent:and:getsockname:or:getsockopt:given:glob: gmtime:and:goto:or:grep:hex:index:int:import:localtime:lock:log:lstat: map:mkdir:last:ioctl:join:keys:kill:last:lc:lcfirst:length:local:link: or:listen:msgctl:msgget:or:msgrcv:msgsnd:my:next:not:oct:open:opendir: ord:our:or:pack:or:pipe:pop:pos:print:printf:prototype:push:quotemeta: rand:read:and:readdir:readline:and:or:readlink:readpipe:recv:redo:ref: rename:require:reset:return:reverse:rewinddir:rindex:rmdir:say:scalar: seek:last:seekdir:select:semctl:semget:semop:send:setgrent:sethostent: setnetent:and:setpgrp:or:setpriority:or:setprotoent:setpwent:shutdown: and:shmread:shmwrite:setservent:or:setsockopt:and:shift:shmctl:shmget: or:sin:sleep:socket:and:socketpair:and:sort:splice:split:sprintf:sqrt: srand:stat:state:study:substr:symlink:syscall:sysopen:sysread:sysseek: system:syswrite:tell:or:telldir:tie:tied:time:times:truncate:uc:undef: and:unimport:unpack:unshift:untie:use:or:utime:values:vec:wait:unlink: or:ucfirst:umask:waitpid:wantarray:warn:when:or:whereis:whereso:write: seek DATA,0,0and print+uc(substr<DATA>,40,1)and print+(uc substr<DATA> ,68,1)and(print+uc(substr<DATA>,51,1))and!print+(uc substr<DATA>,31,1) __DATA__:and:getservent:and:getsockname:or:getsockopt:given:glob:last: die:abs:accept:alarm:atan2:bind:binmode:join:bless:caller:chdir:chmod: chomp:chop:chown:chr:chroot:pos:print:printf:prototype:push:quotemeta: close:closedir:connect:cos:last:crypt:dbmclose:dbmopen:defined:delete: die:dump:each:endgrent:last:endhostent:endnetent:endprotoent:endpwent: endservent:eof:eval:exec:exists:exit:exp:extern:fc:fcntl:fileno:flock: fork:format:formline:getc:or:getgrent:getgrgid:getgrnam:gethostbyaddr: gethostbyname:and:gethostent:or:getlogin:getnetbyaddr:or:getnetbyname: getnetent:getpeername:last:getpgrp:getppid:getpriority:getprotobyname: getprotobynumber:getprotoent:getpwent:getpwnam:getpwuid:getservbyname: getservbyport:and:getservent:and:getsockname:or:getsockopt:given:glob: gmtime:and:goto:or:grep:hex:index:int:import:localtime:lock:log:lstat: map:mkdir:last:ioctl:join:keys:kill:last:lc:lcfirst:length:local:link: or:listen:msgctl:msgget:or:msgrcv:msgsnd:my:next:not:oct:open:opendir: ord:our:or:pack:or:pipe:pop:pos:print:printf:prototype:push:quotemeta: rand:read:and:readdir:readline:and:or:readlink:readpipe:recv:redo:ref: rename:require:reset:return:reverse:rewinddir:rindex:rmdir:say:scalar: seek:last:seekdir:select:semctl:semget:semop:send:setgrent:sethostent: setnetent:and:setpgrp:or:setpriority:or:setprotoent:setpwent:shutdown: and:shmread:shmwrite:setservent:or:setsockopt:and:shift:shmctl:shmget: or:sin:sleep:socket:and:socketpair:and:sort:splice:split:sprintf:sqrt: srand:stat:state:study:substr:symlink:syscall:sysopen:sysread:sysseek: system:syswrite:tell:or:telldir:tie:tied:time:times:truncate:uc:undef: and:unimport:unpack:unshift:untie:use:or:utime:values:vec:wait:unlink: or:ucfirst:umask:waitpid:wantarray:warn:when:or:whereis:whereso:write:

    L*

    There are no rules, there are no thumbs..
    Reinvent the wheel, then learn The Wheel; may be one day you reinvent one of THE WHEELS.
BEGIN X
1 direct reply — Read more / Contribute
by Discipulus
on Jan 31, 2019 at 16:24
    BEGIN{print','; BEGIN{print'r'; BEGIN{print'e'; BEGIN{print'k'; BEGIN{print'c'; BEGIN{print'a'; BEGIN{print'H'; BEGIN{print' '; BEGIN{print'l'; BEGIN{print'r'; BEGIN{print'e'; BEGIN{print'P'; BEGIN{print' ';BEGIN{print'r'; BEGIN{print'e'; BEGIN{print'h'; BEGIN{print't'; BEGIN{print'o'; BEGIN{print'n'; BEGIN{print'A'; BEGIN{print' '; BEGIN{print't'; BEGIN{print's'; BEGIN{print'u'; BEGIN{print'J'; BEGIN{print''; }}}}}}}}}}}}}; }}}}}}}}}}}}};

    Inspired by Assignment and use statement in the same BEGIN block and

    perl -e "$}.=qq(BEGIN{print qq($_);)for(q(,rekcaH lreP rehtonA tsuJ)=~/./g);$}.=q(})x25;eval$}"

    A little modification after having seen it under the morning light.

    L*

    There are no rules, there are no thumbs..
    Reinvent the wheel, then learn The Wheel; may be one day you reinvent one of THE WHEELS.
cOMPRESSed JaPH,
No replies — Read more | Post response
by kschwab
on Dec 30, 2018 at 13:55
    Run on a VT100 compatible terminal
    #!/usr/bin/perl BEGIN{$^="USE\0cOMPRESS\x1a\x1azLIB"^" ",$^=~s,$, $^,ee};$_=q|M'XL(`*[Q*%P"`Y5231J%(`C<=PJ.VJ)E"U?T\\ZSNYDD>(B)HF_P^R V9@A!A(MN"5<0!=]P[@831@,-!4@,\\(N"1%8[U%)BV[Y-,:12L?1&S.C5]A]F4+RES `)M=WN*$C4R#/YH[YT\\/>:$IY/?&(M#&>VATA0W9VBE7T-U<2LWU%.$ALFQ=J"\\M= ICPR"76N)ZYZS7P<7U/*.ZP!N$BHG,%-BZ,`E+WV@_7_N90.FH18I'@K*69M(LSP4X; :C=:)EP[H@MXNEWIO?[&'U@_#@,?:O54D([YD6E$_3F^+*NOL<Q1+4Y0[.M_SP=<;<Y O0'IR@8@`4$|;y| \n||d;$_=unpack'u';$,='-V4Jfdy{lzz33Se`k33dldN|gs'. '`y!-V 2y{`g}2';$,^="\t"x$,=~y,,,c;$,=~s;^;$,;ee;
Perl Golang Partial Polyglot
No replies — Read more | Post response
by kschwab
on Dec 30, 2018 at 09:50

    Similar to my earlier Perl Python Partial Polyglot.

    This one runs under either Golang (go run ./script) or Perl, and produces *mostly* the same output. Arguably not a true polyglot since the Go doesn't depend on the Perl, but the Perl certainly depends on the Go.

    //;$_=<<'/*',y'>>''; package main; func main() { print("Just another Golang Hacker,\n"); } //;main() /* s&(\146\w{3})(.*)\x47\w{5}&lc($1^'5 ,C').$2.('dQFX'^4x4)&es;s;$;$_;ee; */
More fun with a reference
1 direct reply — Read more / Contribute
by kschwab
on Dec 22, 2018 at 12:48
    Stealing part of choroba's idea.
    perl -e 's/^/pack+q.a..($^F^$^F**$^F),qq^\x19"\x11\x04mX^^\$\//e/print +'
Just Another Perl Hacker,
1 direct reply — Read more / Contribute
by choroba
on Dec 21, 2018 at 10:43
    Having fun with references.
    print map{substr$_->[0],$_->[1]||0,1}[\*||{},3],[[]],[ref qr-1,-,-1],[ +{}],[sub{}^*ARGV,3];

    ($q=q:Sq=~/;[c](.)(.)/;chr(-||-|5+lengthSq)`"S|oS2"`map{chr |+ord }map{substrSq`S_+|`|}3E|-|`7**2-3:)=~y+S|`+$1,++print+eval$q,q,a,

Set the new obfuscation standard
Title:
code@?#!:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":


  • 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.
Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others about the Monastery: (7)
As of 2024-03-28 11:14 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found