Tell me more ×
Programming Puzzles & Code Golf Stack Exchange is a question and answer site for programming puzzle enthusiasts and code golfers. It's 100% free, no registration required.

Create the shortest possible obfuscated program that displays the text "Hello World".

In order to be considered an obfuscated program, it must meet at least two of the following requirements:

  • Does not contain the characters: "h", "l", "w" and "d" in any case
  • Does not contain the characters: "e", "o", "r", "0", and "1" in any case
  • Does not contain the characters: "2" or "7"

Input:
none

Output:
Hello World

share|improve this question
I guess import in python is not permitted. – Alexandru Feb 1 '11 at 0:07
What is the difference between letters, characters and numbers. – Alexandru Feb 1 '11 at 0:08
@Alexandru: Just consider them all to be characters, and you'll be fine. – Chris Jester-Young Feb 1 '11 at 0:10
8  
Does these rules apply to language keywords as well? – hallvabo Feb 1 '11 at 13:04
7  
Could someone explain why 2 and 7 are not allowed? I'm just curious as I don't see why those were chosen in particular. – Thomas Eding Aug 5 '11 at 23:01
show 8 more comments

54 Answers

1 2
up vote 22 down vote accepted

GolfScript, 17 chars

'·š““ß¨“›'{~}%

When testing this submission, please save the file as ISO-8859-1, not UTF-8. Having trouble recreating the file? Here's the hexdump of it:

00000000  27 b7 9a 93 93 90 df a8  90 8d 93 9b 27 7b 7e 7d  |'...........'{~}|
00000010  25                                                |%|
share|improve this answer
1  
Although I'd like to think it's an obvious solution, if you're at all unclear about how this entry works, you can read this spoiler: chat.stackexchange.com/transcript/message/442257#442257 :-) – Chris Jester-Young Feb 1 '11 at 0:08
2  
It's not ISO-8859-1, it's actually Windows-1252. – GlitchMr Apr 27 '12 at 11:57

Perl

Since the obvious answer uses shifting of some kind, I feel obligated to post something using Acme::EyeDrops, however with the extra power I thought mine ought to be a little more fun.

                            ''=~('('."\?".
                        '{'.('`'|'%').('['^'-'
                    ).('`'|'!').  ("\`"|       ','
                 ).'"'.('['^'.').   (((           '['
              ))^'(').('`'|('%')).(                  '{'
            ^'[').('{'^'/').('`'|')')                  .+(
          '`'|'-').('`'|'%').':'.':'.(                   '`'
         ^'(').('`'|')').('{'^')').(                      '`'
       |((  '%'))).('['^'(').'\\'.'"'                       .+(
      '['   ^'.').('['^'(').("\`"|                           ','
     ).(    '`'|'%').('`'|"\%").(                             '['
    ^((      '+'))).'\\'.'"'.';'.                              (((
   (((        '\\')))))).('$').                                 '|'
   .((         '+')).'+'.(';').                                 (((
  (((           '\\'))))      )                                  ).+
  '$'            .'\\'.                                          '"'
 .((               '=')    ). "'".                                "'"
 .((                (';'))).       '\\'                           .((
'@'                   )).('`'|                                     '#'
).+                        '='                                     .+(
'`'                          |+    "\-").(                         '`'
|((                            '!'))).("\["^                       '+'
).+                              '\\'.'{'."\[".                    (((
(((                              '\\'))))))."\$".                  '_'
.((                             ',')).'\\'.'$'.('`'|               '*'
).+                             ','.('^'^('`'|('+'))).(            '^'
^+(                              '`'|'.')).'+'.('^'^('`'           |((
'+'                               )))).'*'.'\\'.('$').(            '`'
 |((                               '*'))).'+'.'+'.']'.            (((
 (((                                '\\'))))))."\}".(             '['
  ^((                                '('))).('['^'+')            .+(
  '`'                                |',').('`'|')')             .+(
   '['                                ^'/').('/').              '/'
   .((                                ',')).'\\'.               '"'
    .+(                               '`'^'(').                (((
     '`'                              ))|'%')                 .+(
      '`'                             |',').                 (((
       '`'                           ))|','                 ).(
         '`'                         |'/')                .+(
          '{'                        ^'['                ).(
            '{'                      ^((               ','
              )))                     .(  (          '`'
                 )|+                   ((         '/'
                    )))                        .+(
                        '['                ^((
                            ')'))).(('`')|

                            ',').('`'|'$')
                        .((        '\\')).'"'.
                    ';'       .  ('['^',').(('`')|
                 '('         ). ('`'|')').('`'|',').(
              '`'              |'%').'('.('^'^('`'|'/'))
            .((             ')')).'\\'.'{'.('`'|'-').('['^
          '"'             ).((   (  '\\'))).'$'.('`'|('*')).
         ';'             .+(      ( ( '`'))|'-').('['^('"')).
       '\\'              .+            '@'.('['^'(').'='.("\`"|
      '-').             ('`'|'!'           ).('['^'+').'\\'.'{'.
     "'".(             '{'^"\[").   ((     "'")).'\\'.'}'.('(').(
    '^'^(             '`'|'.')).'.'.'.'.('^'^('`'|'+')).('^'^('`'|
   '.'))            .')'.';'.('`'|'&').('`'|'/').('['^')').'('.'\\'
   .'@'            .('`'|'#').')'.'\\'.'{'.'\\'."\$".(   '['^"\(").
  '['              .'\\'.'$'.'_'.'-'.'>'.'['.('^'^('`'     |',') ).+
  ']'             .']'.'='.'\\'.'$'.'_'.'-'.'>'."\[".(      '^'^ (((
 '`'              ))|'.')).']'.('`'|')').('`'|('&')).        (((  (((
 (((             '\\'))))))))).'$'.'_'.'-'.'>'.'['.           +(  '^'
^+(              '`'|',')).']'.'<'.'='.('^'^('`'|         (    (   '+'
)))               ).('^'^('`'|'.')).';'.'\\'.'$'.'_'.     (    (   '-'
)).                '>'.'['.('^'^('`'|'/')).']'."\>".       (       (((
(((                  '\\')   )))))).'$'.'_'.'-'.'>'                .((
'['                           )).('^'^('`'|(','))).                ']'
.((                           '?')).'\\'.'$'.('`'|                 '*'
).((                          '+')).'+'.':'.'\\'.                  '$'
.('_').                        '-'.'>'.'['.('^'^                   (((
'`'))|','                       )).']'.'-'."\-".                   (((
'\\'))).+                       '}'.('['^'+').(                   '['^
 "\)").(                        '`'|')').("\`"|              (   '.')
 ).('['^                        '/').'\\'."\"".                   (((
  '\\'))                        ).'\\'.('['^')'    )             .((
  '\\')).                      '@'.('['^"\(").   ((              (((
   '\\'))                       ))).'"'.';'.(   '['        ^    '.'
   ).('['                        ^'(').('`'|    ((        (     ','
    )))).                         ('`'|'%')     .              (((
     '`')                         )|'%').(                    '['
      ^((                          '+')))                    .((
       '('                         )).                      (((
         '^'                                          )   )^(
          '`'                                         |  '/'
            )).                                       ('`'
              |((                                    '%'
                 )))                              .+(
                    '^'                        ^+(
                        '`'                |((
                            '+')))).(')').

                            ';'.('`'|',').
                        ('`'|'!').('['^    '('
                    ).('['^'/').(('{')^        '['
                 ).('`'|')').("\`"|    (          '&'
              )).'\\'.'$'.('`'|"\*").                '='
            .'='.'\\'.'@'.('`'|"\#").                  (((
          '\\'))).'}'.('['^'+').('['^  (                 ')'
         )).('`'|')').('`'|'.').('['^   (                 '/'
       )).'\\'.'"'.'\\'.'\\'.('`'      |+                   '.'
      ).'\\'.'"'.('!'^'+').'"'.'}'.   ')'                    );(
     $:)='.'^'~';$~='@'|'(';$^=')'^                           '['
    ;$/='`'|'.';$,='('^'}';$\="\`"|                            '!'
   ;$:=')'^'}';$~='*'|'`';$^=('+')^                             '_'
   ;($/)    ='&'|'@';$,='['&'~';$\                              =((
  "\,"))^    '|';$:  ='.'^'~'; $~                                =((
  '@'))|     "\(";    $^=')'^                                    '['
 ;($/)=      '`'|       '.';$,                                    =((
 '(')        )^+         '}';$\                                   =((
'`')          )|          "\!";      (           (                 $:)
)=')'         ^+        (   (         (                   (        '}'
))));          (           (          (                            $~)
))=(                    (   (    (        (                        '*'
))))                     )   |  ((      (                          '`'
)))                      ;     $^=         (                       '+'
)^+                       ((    ((  ((     '_'                     )))
)))                                          ;($/)                 =((
'&'                          ) )               |'@';               $,=
'['                                                                &((
 '~'                                      ))   ;                  $\=
 ','                                  ^"\|";  $:                  =((
  '.'                               ))^"\~"; $~=                 '@'
  |((                              '('));$^=')'^       (         '['
   );(                          $/)='`'|"\.";$,=    (           '('
   )^+                         '}';$\='`'|'!';$:                =((
    ')'                        ))^'}';$~='*'|'`'               ;$^
     =((                       '+'))^'_';$/='&'               |((
      '@'                      ));$,   =('[')&               '~'
       ;$\                              =','^               '|'
         ;$:                              =(      ((      '.'
          )))                                   ^+       '~'
            ;$~                               =(       '@'
              )|+                                    '('
                 ;$^                              =((
                    ')'                        ))^
                        '['                ;$/
                            ='`'|('.');#;#
share|improve this answer
I tried it and it is just great! +1 – Tomas Oct 10 '11 at 17:55
@TomasT. thanks, it was fun to do, and it actually did take some golfing to get that to run in only 3 pictures! – Joel Berger Oct 10 '11 at 18:15
Too good....... – codaddict Nov 25 '11 at 18:01

HQ9+, 1 char

H

This happens to meet both the second and third requirements.

share|improve this answer
7  
Ive been waiting to see how long it took for someone to post this one. – Kevin Brown Feb 4 '11 at 20:31
12  
The right tool for the job ;) – J B Feb 6 '11 at 9:39
41  
But I don't think it's very obfuscated. I mean, every reasonably competent HQ9+ programmer will immediately see what it does... – Thomas Padron-McCarthy Feb 8 '11 at 8:51
14  
Well, the problem statement does give a very strict definition for "obfuscated" :) – J B Feb 8 '11 at 9:34
19  
Accodingly to this page it prints hello, world instead of Hello World. – BrunoLM Jul 28 '11 at 14:02
show 1 more comment

C# (175 chars)

It was quite a challenge to do this in C# because the restrictions preclude any use of quite a lot of the common keywords. It is possible in C# to use \uxxxx Unicode escape sequences in identifiers, but unfortunately not in keywords.

I suspect that this solution only works when compiled against .NET 4.0. See comments for why.

using System;struct a{static int Main(){object[]c={"\u0048e\x6c\x6co "+(C\u0068ar)(86+1)+"or\x6c\x64"};typeof(Conso\u006ce).GetMet\u0068o\u0064s()[101].Invoke(c,c);return 0;}}

Explanation:

// I won’t be able to get anywhere without using “System”.
// Even if I write it as “Syst\u0065m”, it still violates rule 2.
// Therefore, that is the rule we’ll violate.
using System;

// Thus, we can’t use: H L W D 2 7
// We can’t write “class”, so the Main type must be a struct.
struct a
{
    // We can’t write “void”, so Main needs to return an int.
    static int Main()
    {
        // We can’t write “new”, but we can instantiate an array
        // using the initialisation syntax.
        object[] c = {
            "\u0048e\x6c\x6co " + (C\u0068ar) (86 + 1) + "or\x6c\x64"
        };

        // We can use the character escape sequence to write “Console”, but not
        // “Write” because W is \u0057, which contains a 7. Therefore, we have to
        // use Reflection to get it. This relies on the fact that Console.Write(string)
        // is method #101 in my copy of the framework.
        // Also, the first argument can be anything (needn’t be null) for a static method.
        typeof(Conso\u006ce).GetMet\u0068o\u0064s()[101].Invoke(c, c);

        // Since Main returns int, we have to return something.
        return 0;
    }
}
share|improve this answer
You can use Uri instead of object for b. You can use \xHH in strings instead of \u00HH where it's unambiguous (\x is variable-length). On second thought, you don't need b at all and can just reuse c as the first argument to Invoke. MSDN states that for static methods the first argument is ignored. This brings it down to 175 for me. – Joey Apr 4 '11 at 12:58
@Joey: Whoa, thanks! Although if the first argument to Invoke can be anything, it needn’t even be c, it could be 0... :) – Timwi Apr 4 '11 at 13:27
Yes, noticed that when I tried to inline c (which sadly doesn't work since new requires an e and .Split('x') is too long (came out at 177). – Joey Apr 4 '11 at 13:31
I had no idea this was possible. +1 – Igby Largeman Jun 4 '11 at 20:58
2  
+1 for finding new ways to torture my soul at night. – Neil Jul 14 '11 at 13:07
show 1 more comment

Golfscript - 17 chars

Easier to copy/paste than Chris'

'Ifmmp!Xpsme'{(}%

Basically a caesar cipher shifting by 1 char

share|improve this answer
2  
+1 Nice for being simpler to copy. Mine has the advantage of breaking none of the rules, and also (probably, depending on whether high-bit characters count as symbols) fulfilling symbol golf also. :-) – Chris Jester-Young Feb 1 '11 at 3:30
How does this break a rule? – d-_-b Feb 10 '11 at 14:47
8  
@sims, it has an e in it – gnibbler Feb 10 '11 at 20:05
1  
TWO of the three. :D – Rob Oct 4 '11 at 14:08

BrainFuck, 106 strokes

++++++++++[>+++++++>++++++++++>+++>+<<<<-]>++.>+.+++++++..+++.>++.<<+++++++++++++++.>.+++.------.--------.

Meets all the rules and it sure is obfuscated.

share|improve this answer
I think I can still golf it down a bit, but that will have to wait until I get some sleep. – R. Martinho Fernandes Feb 2 '11 at 1:25
3  
Isn't BrainFuck obfuscated by its definition? – mbx Jul 13 '11 at 11:17
Any competent BF programmer would be able to recognize this... – Mehrdad Aug 5 '11 at 4:10
This breaks both rules 1 and 2 :D – Thomas Eding Aug 5 '11 at 23:04
+1 for this nice brainfuck code. – Mister Smith Sep 20 '11 at 14:35

C

Not particularly golfed, more obfuscated. I did this for a different question (which was deleted) but I thought it quite fun so here it is:

#include <stdio.h>

s[      ]=  {2,6,2,2,+  10          ,2          ,2,10,2,10
,+      10  ,-          1,          2,          6,      2,
2,      2,  10          ,2          ,+          10      ,2
,10,2,6,2,  -1,2,6,2,2  ,2          ,+          10      ,2
,+      10  ,2          ,+          10          ,2      ,6
,2      ,-  1,          10          ,2          ,+      10
,2      ,2  ,10,2,10,2  ,6,2,-1,2,  6,2,2,2,10  ,2,10,2,10

,2   ,6     ,2  ,-  1,2,6,2,2,  2,10,2,10,  2,          10 ,2,6
 ,2   ,-   1,  2,   6,      2,  2,      10  ,2          ,+     10
  ,2   ,+ 10  ,2    ,+      10  ,-      1,  0,          -1     ,2
   ,3   ,2   ,5     ,2      ,2  ,2  ,2      ,+          10     ,2
    ,+ 10,2 ,2      ,+      10  ,2    ,1    ,4          ,-     1,
     0,    1,       2,3,2,3,2,  2,      2,  3,2,6,2,2,  2,6,2,2,2  ,+
                                                                   10
                                                                  ,2

,5      ,2    ,-1,0,    2,         2,  3,2,1,2,2,            2,4,2,
6,      2,  2,      2,   6,       2,   2,                  2,      10
,2      ,5  ,2      ,-    1,     0,    3,                  2,      3,
2,3,2,5,2,  6,2,2,2,2,     2,   6,     2,10,2,5,2          ,-1,0,4,2,
1,      4,  1,      2,      6, 2,      6,                  2,      2,
2,      4,  2,      4,       2,+       10                  ,2      ,5
,2      ,-  1,      0,        5        ,2,4,2,7,+          10      ,2


,2,     6,  2,   2,10,2,9   ,-1},p=220          ,c=42;int     main(i    ,j      ){
for(    i=  0;  i<      p;  i=                  i+      1,  c=      c^   10    ){
if (s   [i  ]<  0)          {q                  ("      &^  #*      ()    ;p  ="
"+  42  ,+  ")  ;}          else{for(j          =0      ;j  <s[i];++j)     r(c)
;}   }} q(  e)  {r          (+                  10      );  };      f(      a,
b,    put)  {"  kl      +=  42                  ;;      if  (u      >t      )"
";     ";}  r(   furious)   {;putchar(          furious)?   1:      2;      };      

This compiles using DevStudio 2005 but does produce a few warnings.

For added fun, the output, in terms of the position of the characters, matches the 'Hello World' in the source code.

UPDATE

Some say the above isn't obfuscated as it breaks the three rules in the original question. Here's another version that only breaks two of the rules, it requires l,d,e and o for language keywords (for, else, #define) and standard system function names (printf). Unfortunately, C doesn't allow you to put unicode escape sequences into the source code (is that really obfuscation?)

#define x (8-8)
#define y (9-8)
#define Z (8-6)

s[      ]=  {Z,6,Z,Z,6  +4          ,Z          ,Z,58,Z,58
,6      +4  ,-          3,          Z,          6,      Z,
Z,      Z,  58          ,Z          ,6          +4      ,Z
,58,Z,6,Z,  -3,Z,6,Z,Z  ,Z          ,4          +6      ,Z
,5      +5  ,Z          ,4          +6          ,Z      ,6
,Z      ,-  3,          58          ,Z          ,5      +5
,Z      ,Z  ,58,Z,58,Z  ,6,Z,-3,Z,  6,Z,Z,Z,58  ,Z,58,Z,58

,Z   ,6     ,Z  ,-  3,Z,6,Z,Z,  Z,58,Z,58,  Z,          58 ,Z,6
 ,Z   ,-   3,  Z,   6,      Z,  Z,      58  ,Z          ,5     +5
  ,Z   ,4 +6  ,Z    ,5      +5  ,-      3,  x,          -3     ,Z
   ,3   ,Z   ,5     ,Z      ,Z  ,Z  ,Z      ,6          +4     ,Z
    ,5 +5,Z ,Z      ,6      +4  ,Z    ,y    ,4          ,-     3,
     x,    y,       Z,3,Z,3,Z,  Z,      Z,  3,Z,6,Z,Z,  Z,6,Z,Z,Z  ,4
                                                                   +6
                                                                  ,Z

,5      ,Z    ,-3,x,    Z,         Z,  3,Z,y,Z,Z,            Z,4,Z,
6,      Z,  Z,      Z,   6,       Z,   Z,                  Z,      58
,Z      ,5  ,Z      ,-    3,     x,    3,                  Z,      3,
Z,3,Z,5,Z,  6,Z,Z,Z,Z,     Z,   6,     Z,58,Z,5,Z          ,-3,x,4,Z,
y,      4,  y,      Z,      6, Z,      6,                  Z,      Z,
Z,      4,  Z,      4,       Z,6       +4                  ,Z      ,5
,Z      ,-  3,      x,        5        ,Z,4,Z,3+4          ,4      +6      


,Z,     Z,  6,   Z,Z,58,Z   ,9,},u=44*          5,c=45-3;     main(i    ,j      ){
for(    i=  x;  i<      u;  i=                  i+      y,  c=      c^   (4+    6)    
){ if   (s  [i  ]<          x)                  {q      ("  #*      ()    ;p  ="
"+  43  ,+  ")  ;}          else{for(j          =x      ;j  <(s[i]&(9+     6));
j=   j+ 1)  p(  c)          ;}                  }}      q(  f)      {p      (5      
+5    );};  f(  a,      b,  t)                  {"      if  (u      >t      )"
;}     p(f  ){   ;printf(   "%c",f,"f"          );345689?   3:      4;      };      

Yeah, I know, #defines! Well, there were just a few too many '2's and inconvenient '1's and '0's to reformat the whole thing. I do have a job to do ;-)

share|improve this answer
2  
For the purposes of this particular task it violated all the rules, though. – Joey Mar 3 '11 at 13:22
@Joey: Yes I know it breaks the rules, but it was for another question that was deleted. I thought that acheiving the layout without using any #defines was worthy of a mention here (it did take a while). Now, how to integrate the #include...? – Skizz Mar 4 '11 at 13:45
4  
If you know that it breaks the rules, then maybe you shouldn’t post it. Duh... – Timwi Mar 8 '11 at 20:30
5  
@timwi: If you know that I know that it breaks the rules, then maybe you shouldn't comment? Although it doesn't meet the question's definition for obfuscation, it is certainly obfuscated and does print "Hello World" when run, so in spirit it is a reasonable answer. – Skizz Mar 8 '11 at 21:59
4  
+1 for thinking outside the square. "Have a nice day" was not needed though. – CMR Mar 9 '11 at 12:35

Befunge-93 - 10x9 block

va:)/v<>#<
9A:)."c:P^
>"iqwt\%"^
bv"Mjq"<.<
c>v<-"x^x]
(C:,3>>^:(
$,9^;)|:O]
>5-^-.--.-
^<_#?>@_@<

Sorry. :D

I wasn't going for small size here, I was trying to really OBFUSCATE the code by including as many smiley faces and noise as possible! :D

Should go with rules 2 and 3.

share|improve this answer
3  
"@_@" I laughed. – Wug Aug 3 '12 at 15:06

Piet (0 chars)

Not mine, but for the sheer beauty of it:

Hello world in Piet

Source: http://www.retas.de/thomas/computer/programs/useless/piet/explain.html

share|improve this answer
5  
169 codels. But please draw it yourself. I have thought of it already and decided against posting someone else's HW. And you should definitely note the codel size. – Joey Mar 3 '11 at 21:55
Oh, and only 143 coding codels :) – Joey Mar 3 '11 at 22:09
16  
This breaks every single rule in the first hundred-some bytes, starting with GIF87a. – boothby Sep 21 '11 at 22:58
3  
@boothby: Only if you happen to view the code as characters. Which is, what you do with interpreted code, but not C, C++, Java, Scala, D code which gets run. – user unknown Mar 26 '12 at 21:36

Python

Rule I & III (34 chars)

print'Uryyb Jbeyq'.decode('rot13')

Rule I & III, alternative (39 chars)

print"\110e\154\154o %cor\154\144"%~-88

Rule II & III (37 chars)

input("H\x65ll\x64 W\x64%cld"%(3*38))

Rule I and II (50 chars)

input('\x48\x65\x6c\x6c\x6f \x57\x6f\x72\x6c\x64')

All three rules (58 chars)

input("\x48\x65\x6c\x6c\x6f %c\x6f%c\x6c\x64"%(84+3,3*38))

share|improve this answer
deleted my answer, i think yours is more comprehensive. – st0le Feb 1 '11 at 13:37
+1,great piece but no surprise I have seen you golfing :-) – Quixotic Mar 8 '11 at 23:05

Bash, 3025 characters

tr G-t F-s<<<Ifmmp\ Xpsme

With thanks to Peter Taylor for the herestring usage.

share|improve this answer
2  
You can save 5 characters using a here string: tr G-t F-s<<<Ifmmp\ Xpsme – Peter Taylor Feb 5 '11 at 20:35

Javascript, 2595

This only breaks rule 2.

゚ω゚ノ=/`m´)ノ~┻━┻//*´∇`*/['_'];o=(゚ー゚)=_=3;c=(゚Θ゚)=(゚ー゚)-(゚ー゚);(゚Д゚)=(゚Θ゚)=(o^_^o)/(o^_^o);(゚Д゚)={゚Θ゚:'_',゚ω゚ノ:((゚ω゚ノ==3)+'_')[゚Θ゚],゚ー゚ノ:(゚ω゚ノ+'_')[o^_^o-(゚Θ゚)],゚Д゚ノ:((゚ー゚==3)+'_')[゚ー゚]};(゚Д゚)[゚Θ゚]=((゚ω゚ノ==3)+'_')[c^_^o];(゚Д゚)['c']=((゚Д゚)+'_')[(゚ー゚)+(゚ー゚)-(゚Θ゚)];(゚Д゚)['o']=((゚Д゚)+'_')[゚Θ゚];(゚o゚)=(゚Д゚)['c']+(゚Д゚)['o']+(゚ω゚ノ+'_')[゚Θ゚]+((゚ω゚ノ==3)+'_')[゚ー゚]+((゚Д゚)+'_')[(゚ー゚)+(゚ー゚)]+((゚ー゚==3)+'_')[゚Θ゚]+((゚ー゚==3)+'_')[(゚ー゚)-(゚Θ゚)]+(゚Д゚)['c']+((゚Д゚)+'_')[(゚ー゚)+(゚ー゚)]+(゚Д゚)['o']+((゚ー゚==3)+'_')[゚Θ゚];(゚Д゚)['_']=(o^_^o)[゚o゚][゚o゚];(゚ε゚)=((゚ー゚==3)+'_')[゚Θ゚]+(゚Д゚).゚Д゚ノ+((゚Д゚)+'_')[(゚ー゚)+(゚ー゚)]+((゚ー゚==3)+'_')[o^_^o-゚Θ゚]+((゚ー゚==3)+'_')[゚Θ゚]+(゚ω゚ノ+'_')[゚Θ゚];(゚ー゚)+=(゚Θ゚);(゚Д゚)[゚ε゚]='\\';(゚Д゚).゚Θ゚ノ=(゚Д゚+゚ー゚)[o^_^o-(゚Θ゚)];(o゚ー゚o)=(゚ω゚ノ+'_')[c^_^o];(゚Д゚)[゚o゚]='\"';(゚Д゚)['_']((゚Д゚)['_'](゚ε゚+(゚Д゚)[゚o゚]+(゚Д゚)[゚ε゚]+(゚Θ゚)+(゚ー゚)+(゚Θ゚)+(゚Д゚)[゚ε゚]+(゚Θ゚)+((゚ー゚)+(゚Θ゚))+(゚ー゚)+(゚Д゚)[゚ε゚]+(゚Θ゚)+(゚ー゚)+((゚ー゚)+(゚Θ゚))+(゚Д゚)[゚ε゚]+(゚Θ゚)+((o^_^o)+(o^_^o))+((o^_^o)-(゚Θ゚))+(゚Д゚)[゚ε゚]+(゚Θ゚)+((o^_^o)+(o^_^o))+(゚ー゚)+(゚Д゚)[゚ε゚]+((゚ー゚)+(゚Θ゚))+(c^_^o)+(゚Д゚)[゚ε゚]+(゚ー゚)+((o^_^o)-(゚Θ゚))+(゚Д゚)[゚ε゚]+(゚Θ゚)+(゚Θ゚)+(c^_^o)+(゚Д゚)[゚ε゚]+(゚Θ゚)+(゚ー゚)+((゚ー゚)+(゚Θ゚))+(゚Д゚)[゚ε゚]+(゚Θ゚)+((゚ー゚)+(゚Θ゚))+(゚ー゚)+(゚Д゚)[゚ε゚]+(゚Θ゚)+((゚ー゚)+(゚Θ゚))+(゚ー゚)+(゚Д゚)[゚ε゚]+(゚Θ゚)+((゚ー゚)+(゚Θ゚))+((゚ー゚)+(o^_^o))+(゚Д゚)[゚ε゚]+(゚ー゚)+(c^_^o)+(゚Д゚)[゚ε゚]+(゚Θ゚)+((o^_^o)-(゚Θ゚))+((゚ー゚)+(o^_^o))+(゚Д゚)[゚ε゚]+(゚Θ゚)+((゚ー゚)+(゚Θ゚))+((゚ー゚)+(o^_^o))+(゚Д゚)[゚ε゚]+(゚Θ゚)+((o^_^o)+(o^_^o))+((o^_^o)-(゚Θ゚))+(゚Д゚)[゚ε゚]+(゚Θ゚)+((゚ー゚)+(゚Θ゚))+(゚ー゚)+(゚Д゚)[゚ε゚]+(゚Θ゚)+(゚ー゚)+(゚ー゚)+(゚Д゚)[゚ε゚]+(゚ー゚)+((o^_^o)-(゚Θ゚))+(゚Д゚)[゚ε゚]+((゚ー゚)+(゚Θ゚))+(゚Θ゚)+(゚Д゚)[゚o゚])(゚Θ゚))('_');
share|improve this answer
I tried it on UglifyJS on it but it saved -2574 bytes. – GlitchMr Apr 27 '12 at 11:53

rot13 - 11 chars

Uryyb Jbeyq

share|improve this answer

><>, 2×20 = 40 characters

'mu{x`)xuunQ'>9-o?v;
            ;^?o-9< 

Violates Rule II, since I cannot output a character without using o.

share|improve this answer

TeX, 95. Breaks the third rule.

\^^5pp^^%^^2^^#^^!^^3^^%{^^(}^^%^^,^^,^^/
\^^5pp^^%^^2^^#^^!^^3^^%{^^7}^^/^^2^^,^^$!
\^^%^^.^^$

Run with tex filename.tex to get a dvi output, or pdftex filename.tex to get a pdf.

share|improve this answer

Whitespace

The 'Hello World' program in Whitespace is worth a mention. I think the 'Say hello' at the start is a comment so it may not break any rules.

Hello World in Whitespace

share|improve this answer
4  
@LuigiPlinge: Useless as opposed to gode golf in other languages? :) Besides, Whitespace isn't even that esoteric. It has a silly input encoding, but other than that, it's a simple stack-based language. – hammar Nov 20 '11 at 17:28
How long is it? – user unknown Mar 26 '12 at 21:40
@userunknown - I count 1287 ws chars in that program, but it prints "Hello, world of spaces!". Here's a 167-char WS program that prints just "Hello World" as required (substitute a space,tab,linefeed for S,T,L respectively):SSSTSSTSSSLTLSSSSSTTSSTSTLTLSSSSSTTSTTSSLTLSSSSSTTSTTSSLTLSSSSSTT‌​STTTTLTLSSSSSTSSSSSLTLSSSSSTSTSTTTLTLSSSSSTTSTTTTLTLSSSSSTTTSSTSLTLSSSSSTTSTTSSLT‌​LSSSSSTTSSTSSLTLSSLLL. – r.e.s. Mar 27 '12 at 18:38
I've entered my preceding comment as a separate Whitespace answer. (It's on Page 2). – r.e.s. Mar 27 '12 at 20:53

Ruby - 63 characters

puts [%w{G d k k n},%w{V n q k c}].map{|l|l.map(&:succ)*''}*' '
share|improve this answer
breaks #1, though – Jan Dvorak Apr 29 at 5:54

Bash, 24 20 characters

You need to have the "bsdgames" package installed.

rot13<<<Uryyb\ Jbeyq

Thanks gnibbler :)

share|improve this answer

PostScript, 41 chars

<64><~+BNK%C]~><48656c6c6f>3{print}repeat

Usage: $ gs -q -dNOPROMPT -dNODISPLAY filename.ps

share|improve this answer
you could also run it like: gsnd -q -- filename.ps – luser droog Nov 24 '11 at 3:47

C (94)

On little Endian machines:

main(){int i[]={1819043144,((0x1bc5c81b|1<<0x14)*4)+3,0xa646c00|(0x39<<1),0};printf("%s",i);}

Violates rule II, but satisfies the rest.

share|improve this answer

JavaScript - 132 characters

(_=(_=[][(f=!!(_='')+_)[3]+(b=({}+_)[(I=-~(z=_-_))])+($=(c=(d=!_+_)[I])+d[z])])())[f[I]+'l'+(a=d[3])+$]("H"+a+'ll'+b+' W'+b+c+'ld')

Breaks rule I

Usage:

  • Paste "javascript: [script]" into browser address bar
  • Make a blank html page, paste the script into a tag
share|improve this answer
Breaks both rule 1 and 2. You are using the number 1 for the arrays. – Kevin Brown Feb 4 '11 at 20:30
You can replace 1 by !![]+![] and 0 by ""-"" to don't break rule #2. – HoLyVieR Feb 15 '11 at 21:13
Thanks @Bass5098 and @HoLyVieR, I kind of missed the 1 and 0 when minimizing the script. I replaced 0 with z=_-_ and 1 with I=-~z, I could also use ++z, but -~ looks nicer :) – m0sa Feb 16 '11 at 7:46
2  
Huh? !![]+![]? Why not just 4-3? – Timwi Mar 9 '11 at 1:32
1  
@Timwi: More obfuscation – Thomas Eding Aug 5 '11 at 23:06
show 3 more comments

Python (31 chars)

exec'import __\x68e\x6c\x6co__'

How it works: hexadecimal character escapes are used to avoid the characters h and l. The resulting string import __hello__ is then executed, resulting in the a module named __hello__ being imported. As a side effect, the module initializer prints Hello world... This module is a (well known?) Python Easter egg.

Disclaimer: I know that the output Hello world... is not strictly conforming to the requirements, but I think it's a nice solution anyway.

share|improve this answer
@Joey: Didn't realize the rules applied to keywords also. Fixed now. – hallvabo Feb 1 '11 at 13:51
Wanna explain how this solution works? Otherwise it’s hard to appreciate. – Timwi Apr 4 '11 at 10:45
@Timwi: import __hello__ is a (well known?) Easter egg in Python. To avoid characters 'h' and 'l' I use hexadecimal string escapes, and then execute the resulting string. – hallvabo Apr 4 '11 at 11:16

PHP, 28 bytes

Not exactly obfuscated, but very short and obvious :). Showing that even when limiting characters you can make very easy to follow programs. Constraints 1 and 3 followed. Constraint 2 was abused.

<?=str_rot13('Uryyb Jbeyq');

Note that this requires short_open_tag being set, unless you're using PHP 5.4 or higher. Maybe some examples are shorter, but I think that this example is pretty short.

share|improve this answer

Scala, 39

Solutions like print("Qnuux)`x{um"map(_-9 toChar)) (35 chars) fall foul of rules 1 and 2 ("toChar" contains both "h" and "r"), which makes this a bit tough.

Finally came up with this:

print("䠀攀氀氀漀 圀漀爀氀搀"map(_.reverseBytes))

Suggestions for improvement welcome

share|improve this answer

Dis, 102 83 chars

Unrolled the code loop since the letters can be generated with less than five consecutive operations. Saved a few characters by reusing the accumulator value: two l are consecutive , SPACE can be generated from o and d can be generated from l.

*>|||{>|||{>||{{>|{|||{>||{>|{>|||{>||{||{!!>**_!!}|_}!^__}|__>*__}|_}|_>!!|_}!^__!

Old version

^}!>^^_^!__!>_^!^^**_^!^^**_
^_!{**_^__!{>_^__{>>!^_!{**_
^_!>^*_^!^^**_^_^^**_*______
___________>||||{^

With comments below. It is using a sequence of five identical operations to generate all the characters in Hello World: one rotation and four subtractions.

^     (move code pointer to data pointer value '^')
}!>^^ (store 'H' in accumulator)
_     (no-op)
^     (data pointer value used by code pointer jump)
!__!> (store 'e' in accumulator)
_     (no-op)
^     (data pointer value used by code pointer jump)
!^^** (store 'l' in accumulator)
_     (no-op)
^     (data pointer value used by code pointer jump)
!^^** (store 'l' in accumulator)
_     (no-op)
^     (data pointer value used by code pointer jump)
_!{** (store 'o' in accumulator)
_     (no-op)
^     (data pointer value used by code pointer jump)
__!{> (store ' ' in accumulator)
_     (no-op)
^     (data pointer value used by code pointer jump)
__{>> (store 'W' in accumulator)
!     (program termination)
^     (data pointer value used by code pointer jump)
_!{** (store 'o' in accumulator)
_     (no-op)
^     (data pointer value used by code pointer jump)
_!>^* (store 'r' in accumulator)
_     (no-op)
^     (data pointer value used by code pointer jump)
!^^** (store 'l' in accumulator)
_     (no-op)
^     (data pointer value used by code pointer jump)
_^^** (store 'd' in accumulator)
_     (no-op)
*     (data pointer value used by code pointer jump to reach '!' between 'W' and 'o')
________________ (no-ops)
_     (no-op, address '^')
>|||| (rotate data value and perform four subtractions)
{     (print value in accumulator)
^     (move code pointer to data pointer value '^' except for the last jump '*')
share|improve this answer

PHP (16 bytes)

I've noticed that my previous PHP example wasn't obfuscated enough, so let's see more blatantly obfuscated examples (warning, obfuscation!). Also, blatantly copying GolfScript example, except making it smaller (is it even possible?). This entry requires either PHP 5.4 or short_open_tag enabled. No rule was broken while making this. In fact, this entry doesn't contain any ASCII letters or digits.

This example doesn't break any of the rules. Have fun. To generate file, run following command.

printf "<?=~\xb7\x9a\x93\x93\x90\xdf\xa8\x90\x8d\x93\x9b;" > obfus.php

Or, in case you don't trust running printf command, I've prepared Base64 dump of the file.

PD89freak5OQ36iQjZObOw==

If you think that both methods to generate it break rules, I also have generated file on Dropbox.

And to run it.

php obfus.php

The resulting file should have 16 bytes. Have fun running it. Please note that if you have E_NOTICE warnings enabled, it will show notice. Just ignore it, fixing it would waste two characters and would make resulting Base64 look less awesome.

share|improve this answer
+1 for the freakin' base64! :D – tomsmeding Apr 28 at 18:22

Befunge-93 - 57 characters

554553943346**,"b"3+,366**::,,3+::,48*,699*+,,+,**,**,+,@

Should meet all three requirements.

share|improve this answer

Windows PowerShell, 95 97 98

($OFS='')+('x)`x{umQnuu'[-4..6]|%{iex("[convert]::"+([convert]|gm -s *pe).name+"($($_-9),4)")})

Violates only Rule II.

It's very evil that char violates two rules on its own already.

And yikes, this one was hard to get working.

  • The first line sets $OFS to '' so when casting an array to a string no spaces appear between items.
  • The string actually stores 'o WorldHell' because I either need [char[]] or .ToCharArray() or indexes to get the characters out of it. Was the first variant where the indexes wouldn't contain 0, 1, 2 or 7 (yes, at that time I was aiming to satify all rules).
  • Casting to char actually was the hardest part of all and I spend around a day searching for a way. I got all the rest working nicely but once I do calculations on them I have ints, not chars. Putting those back in a string was kinda hard.
  • The only way to cast to char I have found that doesn't use the word char is [Convert]::ChangeType which isn't too much nicer, but at least I can get there without having to use h.
  • I found a way of invoking Invoke-Expression without needing the e as well:

    &(gcm i?x)
    

    but that still lacked the arguments. And I've thrown away my goal of satifying all three rules by then already. Also it didn't particularly help me in casting to char.

share|improve this answer

Perl

my @txt = (
  -38,
  -9,
  -6/3,
  -6/3,
  3/3,
  -468/6,
  -69/3,
  3/3,
  4,
  -6/3,
  -30/3,
);

$\ = "\n";
print map{pack 'C', 330/3 + $_} @txt;

I would have been able to do it without any of the of the "forbidden" characters, except there is no easy way, that I can think of to enable the use of anything other than print or die, without using, at least one of the "forbidden" characters.

use feature 'say' # e
use 5.010; # 10
BEGIN{ $^H{'feature_say'} = !'' } # eh
use Modern::Perl # ero

say ...
use IO::Handle; # e
STDOUT->say( ... )

So the only way is to load a module, that internally loads IO::Handle. Which will indirectly enable the use of STDOUT->say.

share|improve this answer

JavaScript, 66 chars

Another JavaScript solution, this time breaking rule #2.

top[(U=unescape)('a%6cert')](U('%48e%6c%6co %5'+(6+1)+'or%6c%64'))

The above follows the concept behind hallvabo's answer. Before I caught on to that approach, I had the arguably-more obfuscated version:

top[8680439[n='toString'](30)]((16+1)[n](z=8*4)[u='toUpperCase']()
+15960[n](33)+'o '+z[n](33)[u]()+1155505[n](36))

which also breaks rule #2 and comes in at 114 chars. (Remove the carriage return in this second solution as it is just there for readability.)

share|improve this answer
I read that as R`unescape`. – muntoo Nov 1 '11 at 23:43
1 2

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.