ppencode 2 - ä»»æã® Perl ã³ã¼ããäºç´èªã ãã® Perl ã³ã¼ãã«å¤æãã
@TAKESAKO ããã ppencode ãä½ã£ã¦ãã 10 å¹´çµã£ã¦ãç§ãä»»æã® Perl ã³ã¼ããå°æåã ãã«å¤æããã¹ã¯ãªãããæ¸ãã¦ããã§ã5å¹´çµã¤ãããã§ããããªããä»»æã® Perl ã³ã¼ããäºç´èªã ãã® Perl ã³ã¼ãã«å¤æããã¹ã¯ãªãããã§ãã¾ããã
http://shinh.skr.jp/obf/ppencode.html
ãªãªã¸ãã«ã® ppencode ã«æ¬æã表ãã¦ããããé°å²æ°ãä¼¼ãã¦ããã¾ãããå²ã¨è²ããªäºç´èªã使ãããããã«ãã¦ã¿ããã¨ãã
ãã㯠Perl ãäºç´èªã ãããã° Turing complete ã¨ãããã¨ãªã®ã§ãå¯ç£ç©ã¨ã㦠Quine ãã§ãã¾ããã
http://golf.shinh.org/reveal.rb?Quine/shinh+%28keywords%29_1431106882&pl
ãªãã¨ãããã ppencode ãããã°å¾ã¯ print ã eval ã«å¤ããã ãã¡ãããï¼ã¨ããå½ç¶ã®çåãããã¨æãã®ã§ããã ppencode ããå²ã¨å¤§å¤ã ã£ãããã¾ãã ppencode ã¯è¦ã¯
print chr 72 xor print chr 101 xor print chr 121 # Hey
ã¿ãããªæãã§å®ç¾ã§ãã¦ãæ°åã®é¨å㯠length q q XXXX q ã¨ããã¦ãã£ã¦ XXXX ã®é¨åã q ãå«ã¾ãªããã¼ã¯ã¼ãã§é©å½ã«åãã¦ããã° OK ã§ãã
ãã ããã¯æåæ°ã ã print ãå¼ã¹ã°è¯ãããã§ããæ¹æ³ã§ãã£ã¦ã eval ã¿ããã«æååãä¸æ¦ã¾ã¨ããå¿ è¦ãããã¨ãã¡ã
å°æåã¢ã«ãã¡ããããã°ã PerlãBase64 ãã°ã Perlã§ã¯ s//something/e ãæåã«é£æãããã¨ã«ãã£ã¦ã好ããªæååãä½ããã¨ãã§ãã¾ããã¼ãã¨ããã®ãããã¾ã§ã®ããããã
ãããäºç´èªã ãã§ãããã¨ããã¨ã
s XX chr length ????? XYYY xor ... xor eval
ã®å½¢ã«ãªãã¨ãã¦ã X 㯠1 æåã®å°æåã¢ã«ãã¡ãããã YYY 㯠e ãå«ãæååã§æ£è¦è¡¨ç¾ã® modifier ã¨ã㦠valid ã§ããã¤ã XX 㨠XYYY ã¯äºç´èªã§ãªãã¨ãããªããã¨ããæ¡ä»¶ã«ãªãã¾ãã XX ã¨åãæåã並ãã§ãäºç´èªã¯ qq ããç¡ãã q ã§ã¯ãã¾ã£ã¦ e ãå«ãå¯ä¸ã®äºç´èªã§ãã quotemeta 㯠t ã modifier ã¨ãã¦ä¸é©åã§ãã
ãããè©°ãã ãªãã¨æ¾ç½®ãã¦ã¾ãããä»åæ°ä»ããã®ã¯ã1åã®æ£è¦è¡¨ç¾ç½®æã§ç¡çãªã2åããã°ç¡çããªã¼ã¨ãããã¨ã§ã
s qq q s X X chr length ????? XYYY
ã®å½¢ãã¤ã¾ãæåã«ç©ºç½ã足ãã¦ããã¦ããããã®ç©ºç½ãæ¬å½ã®æåã«å¤ããã°è¯ãã®ã§ã¯ãªããã¨ã X ãé£ç¶ãã¦ãªãã¦è¯ãã®ã§ã X ã®åè£ã m, q, s, x, y ã®5ã¤ã«å¢ãã¾ããæåã X = s, XYYY = sleep ããã¾ããããããªæ°ããããã§ããã e ã2ã¤ããã¨2å eval ããã¡ãã£ã¦æ±ãã«ããã£ãããããããªãã®ã§ããã¡ãã£ã¨çºãã¦ãã¨ã semop ãããã¾ããããããã¨ã POSIX ãã¾ã splice ã¨ãã該å½ããã¨æãã¾ããã
ããã¾ã§æ¥ãã¨ãã¨ã¯ããã ãã¼ã¨æã£ãã®ã§ããã空ç½ãå«ãã ã¹ã¯ãªããããã¾ãå¤æã§ãã¾ãããä¸çªæåã«ãã空ç½ã次ã®æåã§å ¥ãå¤ãã¦ããã®ã§ã空ç½ãè©°ãã¦ãã¾ãã®ã§ã print "Hey" ã ã¨
___________ # æåã« 11 æå空ç½ã確ä¿(_ ã§ç©ºç½ã示ãã¾ã) p__________ # 1æåãã¤ç©ºç½ãç½®ãããã£ã¦ãã pr_________ pri________ prin_______ print______ print______ # 空ç½ã空ç½ã«ç½®ãå¤ãã¦ã print"_____ # è©°ãããã¦ãã¾ã£ã print"H____ print"He___ print"Hey__ print"Hey"_
ã¨ããããã«å¤æããã¦ããæãã JS ã³ã¼ãä¸ã® ppencode_core ããã®å¤æããã¦ã¾ãã
ããããå ´åã¯ã¾ãã空ç½ãç¡ããè©ä¾¡ããã¨ç©ºç½ãå«ãã Perl ã³ã¼ãã«ãªã Perl ã³ã¼ããä½ã£ã¦ã 2å eval ããã°è¯ãâ¦ã¨ã®ãã¨ã§ä¾ã®ãã¨ã version string ã«æ´»èºãã¦ãããã¾ããã
print "Hey" ã ã¨
$_="";v112.114.105.110.116.32.34.72.101.121.34
ã¨ããã³ã¼ãã ppencode_core ã§ã¨ã³ã³ã¼ããã¦ãããã2å eval ããã°è¯ããã¨ãæåã® $_=""; 㯠$_ ãããã£ã¦ãã¨ãã¾ãå³å¯ãªå¤æãããªããªâ¦ã¨æã£ãããã¤ããã ãã§ãã
é·ãéããæ®éã«ã§ãããããã¼ã®ï¼ãâããããã§ããªããªããããå®æçã«ç¹°ãè¿ãã¦ãã®ã§è§£æ±ºãã¦è¯ãã£ãã¨è¨ãã¾ã