Sólo otro hacker de Perl , o JAPH , normalmente se refiere a un programa de Perl que imprime "Sólo otro hacker de Perl" (la coma es canónica pero ocasionalmente se omite). Los programas breves de JAPH se utilizan a menudo como firmas en foros en línea o como diseños de camisetas . La frase o acrónimo también se usa ocasionalmente (sin código ) para una firma.
Los programas JAPH se realizan clásicamente utilizando métodos extremadamente ofuscados , en el espíritu del Concurso C ofuscado . Más recientemente, dado que el fenómeno se ha vuelto tan conocido, la frase a veces se usa en ejemplos ordinarios (sin ofuscación).
La idea de usar pequeños programas de Perl que imprimen una firma como firma fue originada por Randal L. Schwartz , en sus publicaciones en el grupo de noticias comp.lang.perl. [1] Escribió muchos de los JAPH que se muestran a continuación.
Ejemplos de
Programa JAPH sin ofuscación:
imprimir "Sólo otro hacker de Perl" ;
Incrustación de JAPH en código opaco:
$ _ = '987; s / ^ (\ d +) / $ 1-1 / e; $ 1? Eval: print "Solo otro hacker de Perl",' ; eval ;
Decodificando JAPH a partir de una cadena literal transpuesta :
$ _ = "krJhruaesrltre ca cnP, ohet" ; $ _ . = $ 1 , imprime $ 2 mientras s /(..)(.)// ;
Impresión de JAPH como procesos separados:
for $ i ( 0 .. 4 ) { if ( ! fork ) { $ i == 0 o no { $ SIG { INT } = sub { print "J" } } o $ i == 1 o no { $ SIG { INT } = sub { imprimir "A" } } o $ i == 2 o no { $ SIG { INT } = sub { imprimir "P" } } o $ i == 3 o no { $ SIG { INT } = sub { imprimir "H" } } ; dormir $ i ; durar ; } }matar INT => $$ ;
Apareciendo como si hiciera algo completamente ajeno a la impresión de JAPH:
$ _ = "wftedskaebjgdpjgidbsmnjgc" ; tr / az / o h , cuello de tortuga Phrase Jar ! / ; imprimir ;
Procesos de bifurcación para imprimir una letra cada una en el orden correcto: [2]
@P = split // , ".URRUU \ c8R" ; @d = split // , "\ nrekcah xinU / lreP rehtona tsuJ" ; sub p { @p { "r $ p" , "u $ p" } = ( P , P ); tubería "r $ p" , "u $ p" ; ++ $ p ; ( $ q * = 2 ) + = $ f =! tenedor ; mapa { $ P = $ P [ $ f ^ ord ( $ p { $ _ }) & 6 ]; $ p { $ _ } = / ^ $ P / ix ? $ P: cerrar $ _ } teclas % p } p ; p ; p ; p ; p ; mapa { $ p { $ _ } = ~ /^[P.]/ && close $ _ } % p ; esperar hasta $? ; mapa { / ^ r / && <$ _> } % p ; $ _ = $ d [ $ q ]; dormir rand ( 2 ) si / \ S / ; impresión
Usando solo palabras clave de Perl (sin puntuación ): [3]
no exp log srand xor s qq qx xor s x x longitud uc ord e imprime chr ord para qw q join use sub atado qx xor eval xor print qq q q xor int eval lc q m cos e imprime chr ord para qw y abs ne abrir atado hex exp ref y m xor escalar srand impresión qq q q xor int eval lc qq y sqrt cos y imprimir chr ord para qw x printf cada retorno local de x y o impresión qq s s y eval q s undef o octubre xor tiempo xor ref print chr int ord lc foreach qw y hex alarm chdir kill exec return y s gt sin sort split
Utilizando solo puntuación , sin caracteres alfanuméricos . Esto se rompe después de Perl 5.30.0, ya que el uso de $ # y $ * crea errores fatales. Este JAPH fue escrito por Eric Roode y sólo funciona en Unix y Unix-como sistemas:
`$ =` ; $ _ = \ % !; ($ _ ) = /(.)/ ; $ = = ++ $ | ; ( $. , $ / , $, , $ \ , $" , $; , $ ^ , $ # , $ ~ , $ * , $: , @% ) = ( $! = ~ / () (.. ). (.) (.) (.) (.) .. (.) (.) (.) .. (.) ...... (.) / , $ " ), $ = ++ ; PS ++ ; PS ++ ; $ _ ++ ; $ _ ++ ; ( $ _ , $ \ , $, ) = ( $ ~ . $ " . " $; $ / $% [$?] $ _ $ \ $, $: $% [$?] " , $ " & $ ~ , $ # ,); $, ++ ; $, ++ ; $ ^ | = $ " ; ` $ _ $ \ $, $ / $: $; $ ~ $ * $% [$?] $. $ ~ $ * $ {#} $% [$?] $; $ \ $ "$ ^ $ ~ $ *.> & $ =`
A much shorter one, using only punctuation, based on the EyeDrops module:
''=~('(?{'.('-)@.)@_*([]@!@/)(@)@-@),@(@@+@)'^'][)@]`}`]()`@.@]@%[`}%[@`@!#@%[').',"})')
ASCII art (to make this dromedary-shaped code work, the console size needs to be set to at least 119×48):[4]
# sub j(\$){($ P,$V)= @_;while($$P=~s:^ ([()])::x){ $V+=('('eq$1)?-32:31 }$V+=ord( substr( $$P,0,1,""))-74} sub a{ my($I,$K,$ J,$L)=@_ ;$I=int($I*$M/$Z);$K=int( $K*$M/$Z);$J=int($J*$M /$Z);$L=int($L*$M/$Z); $G=$ J-$I;$F=$L-$K;$E=(abs($ G)>=abs($F))?$G:$F;($E<0) and($ I,$K)=($J,$L);$E||=.01 ;for($i=0;$i<=abs$E;$i++ ){ $D->{$K +int($i*$F/$E) }->{$I+int($i*$G/$E)}=1}}sub p{$D={};$ Z=$z||.01;map{ $H=$_;$I=$N=j$H;$K=$O=j$H;while($H){$q=ord substr($H,0,1,"" );if(42==$q){$J=j$H;$L=j$H}else{$q-=43;$L =$q %9;$J=($q-$L)/9;$L=$q-9*$J-4;$J-=4}$J+=$I;$L+=$K;a($I,$K,$J,$ L); ($I,$K)=($J,$L)}a($I,$K,$N,$O)}@_;my$T;map{$y=$_;map{ $T.=$D->{$y} ->{$_}?$\:' '}(-59..59);$T.="\n"}(-23..23);print"\e[H$T"}$w= eval{ require Win32::Console::ANSI};$b=$w?'1;7;':"";($j,$u,$s,$t,$a,$n,$o ,$h,$c,$k,$p,$e,$r,$l,$C)=split/}/,'Tw*JSK8IAg*PJ[*J@wR}*JR]*QJ[*J'. 'BA*JQK8I*JC}KUz]BAIJT]*QJ[R?-R[e]\RI'.'}Tn*JQ]wRAI*JDnR8QAU}wT8KT'. ']n*JEI*EJR*QJ]*JR*DJ@IQ[}*JSe*JD[n]*JPe*'.'JBI/KI}T8@?PcdnfgVCBRcP'. '?ABKV]]}*JWe*JD[n]*JPe*JC?8B*JE};Vq*OJQ/IP['.'wQ}*JWeOe{n*EERk8;'. 'J*JC}/U*OJd[OI@*BJ*JXn*J>w]U}CWq*OJc8KJ?O[e]U/T*QJP?}*JSe*JCnTe'. 'QIAKJR}*JV]wRAI*J?}T]*RJcJI[\]3;U]Uq*PM[wV]W]WCT*DM*SJ'. 'ZP[Z'. 'PZa[\]UKVgogK9K*QJ[\]n[RI@*EH@IddR[Q[]T]T]T3o[dk*JE'. '[Z\U'. '{T]*JPKTKK]*OJ[QIO[PIQIO[[gUKU\k*JE+J+J5R5AI*EJ00'. 'BCB*'. 'DMKKJIR[Q+*EJ0*EK';sub h{$\ = qw(% & @ x)[int rand 4];map{printf "\e[$b;%dm",int(rand 6)+101-60* ($w ||0);system( "cls")if$w ;($A,$S)= ($_[1], $ _[0]);($M, @,)= split '}';for( $z=256 ;$z>0; $z -=$S){$S*= $A;p @,} sleep$_ [2];while ($_[3]&&($ z+=$ S) <=256){ p@,}}("". "32}7D$j" ."}AG". "$u}OG" ."$s}WG" ."$t","" ."24}(" ."IJ$a" ."}1G$n" ."}CO$o" ."}GG$t" ."}QC" ."$h}" ."^G$e" ."})IG" ."$r", "32}?" ."H$p}FG$e}QG$r". "}ZC" ."$l", "28}(LC" ."" ."". "$h}:" ."J$a}EG". "$c" ."}M" ."C$k}ZG". "$e" ."}" ."dG$r","18" ."}(" ."D;" ."$C" )}{h(16 ,1,1,0 );h(8, .98,0,0 );h(16 ,1,1,1) ;h(8.0 ,0.98,0, 1); redo}### #written 060204 by #liverpole @@@@@@@ #@@@@@@@@@@@
Ver también
Referencias
- ^ Randal L. Schwartz in Usenet message [email protected] explaining the origin of JAPH. Available through Google.com
- ^ Plover.com
- ^ Originally posted at perlmonks.org by user blokhead
- ^ Originally posted at perlmonks.org by user liverpole.
Otras lecturas
- Simon Cozens (2005). Advanced Perl Programming. O'Reilly. pp. 261–263. ISBN 9780596004569.
enlaces externos
- Cultured Perl: The Elegance of JAPH
- Cpan.org, a collection of JAPHs at CPAN.
- How does this famous JAPh work? and Fun With Reserved Keywords at Stack Overflow explain how blokhead's code works.