Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How does this famous JAPH work?

Tags:

not exp log srand xor s qq qx xor s x x length uc ord and print chr ord for qw q join use sub tied qx xor eval xor print qq q q xor int eval lc q m cos and print chr ord for qw y abs ne open tied hex exp ref y m xor scalar srand print qq q q xor int eval lc qq y sqrt cos and print chr ord for qw x printf each return local x y or print qq s s and eval q s undef or oct xor time xor ref print chr int ord lc foreach qw y hex alarm chdir kill exec return y s gt sin sort split 

Like any other JAPH, this prints out "just another perl hacker". But I'd like a semi-detailed dissection of what behavior this particular JAPH is taking advantage of to work - I'm no good at Perl, but some JAPHs I can read through... this, no way.

like image 486
PinkElephantsOnParade Avatar asked Jan 21 '13 14:01

PinkElephantsOnParade


1 Answers

It's really not that hard once you understood the basics. Here are some hints to get you started:

not exp log srand         # srand = 1, exp o log = id, not 1 = 0          # $_ = undef xor s// /x                               # $_ = ' ' xor s/ / length uc ord and print chr ord for qw q join use sub tied q/         # $_ = ' length uc ord and print chr ord for qw q join use sub tied q'  xor eval 

Note that chr ord of a string returns the first character and join use sub tied in the end has the first characters j, u, s, t. :)

Just for fun, I wrote an extension of this famous japhs years ago:

not srand xor s qq qx xor s x x length uc ord and print uc chr ord for qw q join qx xor eval xor lc eval qq x abs cos ord and print chr ord for qw q use substr tied qx xor print qq q q xor int eval lc qq m cos and print chr ord for qw y abs ne or tied hex exp ref y m xor scalar srand print qq q q xor sin abs eval q x log srand ord or printf uc chr ord foreach qw q package qx xor sqrt eval lc qq y sqrt cos and printf chr ord for qw x each return local x y or print qq s s and uc exp eval q s undef or oct xor time xor ref print chr int ord lc for qw y hex alarm chdir kill exec return y s xor log exp eval q x print chr length join qw y length for map substr chr shift y x or sqrt abs ord lc and eval print q q q and s q q lcfirst chr eval log shift qx 

printing the real string "Just another Perl hacker,\n".

And this is a smaller version containing a german christmas greeting:

not exp log srand xor s qq qx xor s x x length uc ord and print chr ord for qw q find redo ord helpme eval scalar qx xor eval xor print q q q xor int eval lc q m cos and print chr ord for qw y flock each s tell y m gt sin ref study split 
like image 136
memowe Avatar answered Oct 05 '22 06:10

memowe