Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

10 languages

by Anonymous Monk
on Jan 16, 2006 at 00:34 UTC ( [id://523373]=obfuscated: print w/replies, xml ) Need Help??

Continuing the good traditions set by truedfx, I've written just another program.
%:/*:if 0;"true" +s ||true<</;#|+q|*/include<stdio.h>/*\_/ {\if(%)}newpath/Times-Roman findfont 20 scalefont setfont( %%)pop 72 72 moveto(Just another PostScript hacker,)show(( t)}. t:-write('Just another Prolog hacker,'),nl,halt. :-t. :-initialization(t). end_of_file. %)pop pop showpage(-: */ int main(){return 0&printf("Just another C%s hacker,\n",1% sizeof'2'*2+"++");}/*\fi}\csname @gobble\endcsname{\egroup \let\LaTeX\TeX\ifx}\if00\documentclass{article}\begin{doc% ument}\fi Just another \LaTeX\ hacker,\end{document}|if 0; /(J.*)\$sh(.*)"/,print"$1Perl$2$/"if$_.=q # hack the lang! / sh=sh;test $BASH_VERSION &&sh=bash;test $POSIXLY_CORRECT&& sh=sh;test $ZSH_VERSION && sh=zsh;awk 'BEGIN{x="%c[A%c[K" printf(x,27,27)}';echo "Just another $sh hacker," #)pop%*/

Please forgive that it is not as hard to understand as it should be -- but believe me it was hard enough to write it, since this is my first obfuscation attempt in all the ten programming languages I know.

Next week I will be learning 10 more languages. I hope I can keep this learning rate throughout the year, and in December I can write my Christmas carol in any language, and nobody will understand it.

Edit: g0n - linkified href link

Replies are listed 'Best First'.
Re: 10 languages
by chargrill (Parson) on Jan 16, 2006 at 08:33 UTC
    Well, since you're here, the list has to include perl.

    So here's what I can see:

    • c
    • ...

    You know what, I give up. I assume there's c++ (assuming you're counting it separate from c), perl, and bash. Given some of the strings in there, I'd assume tex. You mention prolog, but I'm completely unfamiliar with that. Is that pdf in there? Postscript, I guess. Don't tell me you're counting different shells (bash,zsh) as different languages...

    I just don't have the energy to parse this.

    Had I any votes left, you'd get 'em.

      C, C++, Perl, Prolog, sh, bash, zsh, TeX, LaTeX and PostScript makes for ten different outputs, but even if you don't want to count them all as separate languages, that's still a very impressive six.
Re: 10 languages
by truedfx (Monk) on Jan 16, 2006 at 16:45 UTC

    Nice, I'm surprised there was more to add without breaking the rest. I've been looking at Lisp myself, but unfortunately there doesn't seem to be a way to add that without making either the C or the Lisp code invalid, or removing some other language. (C, Lisp, Perl, and maybe sh and TeX is doable though. The big problem is PostScript.)

    Update: Yup, C, Lisp, Perl, sh and TeX is possible:

    // +'+%#| //\output{\setbox0\vbox{\box255}\setbox0\hbox{\parindent0ptJust anothe +r \TeX\ hacker,}\shipout\box0}\bye #include <stdio.h> int main() { puts("Just another C hacker,"); } /*%|# (princ "Just another Lisp hacker, ") (quit) +'+ 2>&- if print "Just another Perl hacker, " and exit; printf "Just another sh hacker, "; exit #*/
      If you open a paren in PostScript, it just starts a string, which you can cancel later with `pop'. And a paren is a quite harmless character in most other languages. See the 1st two lines in my original code.
        Thanks. Unfortunately, the problem is that a C program (again, unless you don't mind making it invalid) can't start with a (; it must start with a keyword after preprocessing, and before preprocessing, the only ways around that are by starting with #, %:, //, /*, or _Pragma, possibly combined with \. (Technically, trigraphs could also be used, but ?? causes even bigger problems.) Comments in Lisp start with ; or are embedded in #|...|#, so the opening must be a valid Lisp expression. The two things that don't break C that I could find are //, and #\ followed by a newline. Both seem to unconditionally break PostScript, but if you have a way around that, I'd be very interested.
Re: 10 languages
by turo (Friar) on Jan 18, 2006 at 16:17 UTC

    Me arrodillo ante tu maestría! Olé Olé y Olé!!!

    turo@indus:/tmp$ latex idle.tex Output written on idle.dvi (1 page, 320 bytes). Transcript written on idle.log. turo@indus:/tmp$ xdvi idle. ...
    10 languages?
    turo@indus:/tmp$ perl idle.tex Just another Perl hacker,
    (this one was expected ...) ...
    turo@indus:/tmp$ sh idle.tex Just another sh hacker,
    ...
    turo@indus:/tmp$ gcc -o idle idle.c turo@indus:/tmp$ ./idle Just another C hacker,

    Really impressed!!! ... Men you are my Idol ... and there are 6 hidden langs ... You are my Hero!!! Yeahha!!!

    perl -Te 'print map { chr((ord)-((10,20,2,7)[$i++])) } split //,"turo"'

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: obfuscated [id://523373]
Approved by sk
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others sharing their wisdom with the Monastery: (3)
As of 2024-04-20 09:17 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found