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

  • 5
    I guess import in python is not permitted. – Alexandru Feb 1 '11 at 0:07
  • 25
    Does these rules apply to language keywords as well? – hallvabo Feb 1 '11 at 13:04
  • 7
    are those case insensitive restrictions? – oenone Aug 4 '11 at 14:22
  • 17
    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
  • 3
    @trinithis, and others, ASCII character 72 is "H" which is why I chose those two – Kevin Brown Sep 18 '11 at 23:18

117 Answers 117

up vote 51 down vote accepted

GolfScript, 17 chars

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

When testing this submission, please save the file as straight binary, 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                                                |%|
  • 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
  • 12
    It's not ISO-8859-1, it's actually Windows-1252. – Konrad Borowski Apr 27 '12 at 11:57
  • @GlitchMr: I'm actually pretty certain the submission contains characters that are outside of Windows-1252 too. ;-) – Chris Jester-Young Apr 27 '12 at 12:40
  • @xfix It really isn't Windows-1252 either. Although Windows-1252 has more valid characters than ISO-8859-1, my entry contains characters, such as 0x8D and 0x90, that aren't valid in Windows-1252 either. – Chris Jester-Young Sep 25 '15 at 0:45
  • Fair enough, forgot that some characters are disallowed in Windows-1252. – Konrad Borowski Sep 26 '15 at 8:36

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.

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

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

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

Caveat

Since Perl version 5.18, the mechanism that allows this code to run has become so powerful that it has been disabled by default to prevent misuse. Therefore on versions 5.18+ you can either add use re 'eval'; to the top of the script or, if the script is named world.pl you can run it like perl -Mre=eval world.pl. It is unfortunate that these unsightly characters must be added, but c'est la vie. (Note: I want to emphasize that enabling this feature is not using some library or addon, the code displayed is valid Perl code, the mechanism is simply no longer enabled by default).

  • 1
    I tried it and it is just great! +1 – Tomas Oct 10 '11 at 17:55
  • 2
    @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
  • 1
    FYI It uses the Perl regexp feature (?{ code }) to evaluate custom Perl code while regexp matching. The custom Perl code prints the message. It's nice because it doesn't violate any of the rules. – pts Aug 23 '13 at 22:54
  • 5
    You sir, are the hello world king! – recursion.ninja Jan 4 '14 at 15:27
  • 1
    Wow! Just wow! Now I need to learn Perl just to see how on earth you did that. – Gryphon Jun 10 '17 at 13:39

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 explanation 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 the 102nd method of the type Console in my copy of the framework.
        // Also, the first argument to Invoke can be anything for a static method
        // (needn’t be null). The second one is the actual argument to Console.Write.
        typeof(Conso\u006ce).GetMet\u0068o\u0064s()[101].Invoke(c, c);

        // Since Main returns int, we have to return something.
        return 0;
    }
}
  • 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
  • 1
    Very intelligent thing you did with GetMethods. +1 – Soham Chowdhury Apr 27 '13 at 14:29

BrainFuck, 106 strokes

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

Meets all the rules and it sure is obfuscated.

  • 1
    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
  • 34
    Isn't BrainFuck obfuscated by its definition? – mbx Jul 13 '11 at 11:17
  • 18
    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
  • 7
    Brah, Protected by community, whatever, ++++++++++[>++++++>+++<<-]>++++++++++++.---.+++++++..+++.>++.<++++++++.--------.+++.------.--------. is just 100 strokes, mine is better than yours – OverCoder Aug 13 '15 at 14:12

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゚])(゚Θ゚))('_');
  • 12
    I tried it on UglifyJS on it but it saved -2574 bytes. – Konrad Borowski Apr 27 '12 at 11:53
  • 11
    I have no idea what I'm looking at here. – Bob Jan 13 '14 at 5:59
  • 6
    @Bob = obfuscated Javascript. Hint: it starts by assigning a regular expression literal (namely '/`m´)ノ~┻━┻/') to a variable with the name ` ゚ω゚ノ. That's followed by a comment and the expression ['_']` in void context. Then the variable o (along with _ and (゚ー゚)) is assigned the value 3. It continues in that vein, doing lots of extra harmless work that is effectively no-ops, and using roundabout ways to do the intended work (calling alert("Hello world")) in a non-obvious fashion. – Mark Reed Jan 21 '14 at 3:15
  • 4
    Source: utf-8.jp/public/aaencode.html – Jason C Mar 24 '14 at 5:27

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.

  • 17
    "@_@" I laughed. – Wug Aug 3 '12 at 15:06

Golfscript - 17 chars

Easier to copy/paste than Chris'

'Ifmmp!Xpsme'{(}%

Basically a caesar cipher shifting by 1 char

  • 4
    +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
  • 11
    @sims, it has an e in it – gnibbler Feb 10 '11 at 20:05
  • 2
    TWO of the three. :D – Rob Oct 4 '11 at 14:08

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))
  • 1
    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
  • You need to import codecs before you can codecs.decode – cat Oct 22 '15 at 23:45
  • You can remove the parens in the first solution – Cyoce Oct 17 '16 at 2:38

JavaScript, 366 chars

After seeing Joel Berger's Perl solution, I felt compelled to do some ASCII art prettiness myself... JavaScript, uses no alphanumerics, and contrary to JSFuck output it's actually reasonably sized.

                   $$
                  =-~-
                 ~[];$_
                =$$+ $$;
               _$=$$+$$+-
              ~[];_=-~[];$
             =!![]+[];__={}
            +[];$$_=/\\ /+[]
           _$$=(![]+[])[_]+(!
          []+[])[$$]+$[$_+~[]]
         +$[_]+$[+[]];$=__[_$]+
        __[_]+($[$]+[])[_]+(![]+
       [])[$_+~[]]+$[+[]]+$[_]+$[
      $$]+__[_$]+$[+[]]+__[_]+$[_]
     _=$$_[_]+-~[];$[$][$](_$$+'("'
    +_+-~[]+-[]+_+$_+_$+_+_$+$_+_+_$
   +$_+_+_$+[$$+_$]+$$_[-~[]]+$_+-[]+
  _+$$+[$$+_$]+_+_$+[$$+_$]+_+[$$+$_]+
                $$+ _+_$
                +$_+_+$_
                +$_+'")'
                  )($)
  • could you please display the number of characters in your code in the heading? I'm curious to see how many you got it to... – WallyWest Jan 20 '14 at 22:32
  • @Eliseod'Annunzio there you go, I forgot that this was code-golf. Length is given with whitespace stripped and the last ($) turned into () (because I added $ for symmetry). – FireFly Jan 20 '14 at 22:53
  • Thanks for your tips... I had to resize my code out to account for the "W" and then shrunk it down using your advice... – WallyWest Jan 21 '14 at 0:58

rot13 - 11 chars

Uryyb Jbeyq

  • 3
    Is rot13 a language? :/ – Santosh Kumar Nov 16 '15 at 8:12
  • 3
    yes and I can create its interpreter :P – Ahmed Abd El Mawgood Mar 14 '16 at 17:07
  • 5
    Technically, rot13 is just a cipher. It is as much a langauge as a Vigenère cipher. – XiKuuKy Sep 14 '16 at 10:47

Google translate, 2 chars

喂世

It's in Chinese.

In fact it is a code in Google translate language that produces "Hello World".

  • 10
    Nope, it's Feed the world. – ericw31415 Dec 30 '16 at 2:16
  • 4
    你好世 seems to be more reliable – Digital Trauma Jan 8 '17 at 23:10
  • 2
    You have a good life?? – programmer5000 Mar 28 '17 at 17:24
  • 2
    你好 世界! actually is Hello World. – MD XF Oct 6 '17 at 16:19

Bash, 30 25 characters

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

With thanks to Peter Taylor for the herestring usage.

  • 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

TeX, 95 Bytes

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.

  • 1
    Wow, never knew TeX can be so obfuscated! – gar Jun 2 '14 at 18:04

><>, 2×20 = 40 characters

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

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

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

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.

  • There's still lots of "o"s and "e"s in here, and an "r". Not sure I'd have much better luck cleaning that out either, though. Might yet have to give it a shot sometime. – Iszi Nov 17 '13 at 5:01
  • Just re-read the rules - only needed two of the three rulesets met, and this does qualify. Good show! Would be uber-awesome if we could come up with one that takes 3/3, but I doubt that's very possible. – Iszi Nov 17 '13 at 8:03
  • Took me plenty of time to get to this point already, and I still doubt it's possible to follow all rules. – Joey Nov 17 '13 at 11:43

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 one character (I can use @ operator, after all) and would make resulting Base64 look less awesome.

Whitespace (167 characters)

To obtain the WS program, substitute a Space, Tab, or Linefeed character for S, T, L, respectively, in the following string:

SSSTSSTSSSLTLSSSSSTTSSTSTLTLSSSSSTTSTTSSLTLSSSSSTTSTTSSLTLSSSSSTTSTTTTLTLSSSSSTSSSSSLTLSSSSSTSTSTTTLTLSSSSSTTSTTTTLTLSSSSSTTTSSTSLTLSSSSSTTSTTSSLTLSSSSSTTSSTSSLTLSSLLL

or download the "raw" whitespace-only program in the text-file hello.ws.

When executed by this WS interpreter, this program prints "Hello World".

Explanation (ignore the whitespace here!):

SSS TSSTSSSL TLSS  <-- output H (ascii code 72 in decimal, 1001000 in binary) 
SSS TTSSTSTL TLSS  <-- output e (ascii code 101 in decimal, 1100101 in binary) 
SSS TTSTTSSL TLSS  <-- etc
SSS TTSTTSSL TLSS
SSS TTSTTTTL TLSS
SSS TSSSSSL TLSS
SSS TSTSTTTL TLSS
SSS TTSTTTTL TLSS 
SSS TTTSSTSL TLSS 
SSS TTSTTSSL TLSS
SSS TTSSTSSL TLSS 
LLL                <-- end the program

The "middle" strings (e.g. TSSTSSSL) are the ascii codes (in binary, with S denoting 0, T denoting 1) for the successive letters in "Hello World". The prefix SSS pushes the number that follows it (terminated by an L) onto the stack. TLSS outputs the character whose ascii code is on top of the stack. Finally, according to this tutorial, a program must end with LLL for a clean exit by the interpreter.

NB: I'm entering this as a separate answer, because the other WS program entry is a 1287-character program that prints "Hello, world of spaces!" instead of the required "Hello World".

Ruby - 63 characters

puts [%w{G d k k n},%w{V n q k c}].map{|l|l.map(&:succ)*''}*' '
  • breaks #1, though – John Dvorak Apr 29 '13 at 5:54
  • And even shorter: puts "Gdkkn~Vnqkc".split("").map(&:succ)*'' - 43 – Biketire Jul 7 '15 at 13:59

C, 160 chars

Works only on little-endian machines with 4-byte int:

main(){int a='a',b=a/a,c=b+b,f=c+c,g=f+f,i=g+g,j=i*i,k=j*j,m=a+g+b+c,n=m+b+c;int p[]={a+g-b+(a+f)*j+m*k*(j+b),n+i*c*j+k*(n+g+n*j),a+i+b+m*j+(a+f-b)*k};puts(p);}

Satisfies all three rules.

  • 1
    You could just use numeric constants without 0,1,2,7: p[];main(){p={(5*5*5*5*5*64+96696)*(443+5688),(5*3*4*3+4-3)*(66*45*6-6*6-4+3)*8‌​3*(3+4),6544494+36868};puts(p);} -- 111 chars. – user21677 Jun 13 '15 at 3:44
  • 1
    Similar vein (actually tackled the problem in a few different ways before settling on this). x[]={45483*39994-3958,48465*38543-5584,6584695-3333};main(){puts(x);} - 69 characters. I'm sure I could shave a few more off given more time to mathify the literals some more. Was a fun way to spend a couple hours, anyway :) – Cole Cameron Jul 7 '15 at 19:11

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.

bash 28 chars:

printf 'p|ɹ°M ο||ǝ%b'"\x48"

p|ɹοM ο||ǝH

alternatively with /bin/echo (18 chars) *) see discussion below.

/bin/echo -e 'p|ɹοM ο||ǝ\0110'

Selftest:

echo "printf 'p|ɹοM ο||ǝ%b' "\x48"" | egrep -i "[^hlwd27eor01]"

Harder than thougth! Tools, for turning Words upside down, the tools think an 'H' or 'o' turned upside down is best displayed as H or o. This would be in conflict with group 1 (Hlwd:27:eor01) respectively 3.

H can be displayed with

echo -e "\0127"

but 01 and 2 are poisoned too. Gee! But the bash-buildin echo has not only the option to display octal ascii values, but hexadecimal too:

echo -e "\x48"

But if we use bash as a programming language, the echo command is part of the program, which not only counts to the character count, but also contains the poisoned characters (hlwd:27:eor01) eho from groups 1 and 3.

So this is moment the echo died. Fortunately, there is printf, which knows "%b" to display .

The r is the only problematic character in printf, and belongs to group 3. Since 'o' is in the last group, we could leave it in Hello and in World, but we can use the omicron ο which looks like an o, or ° &deg;.

Links:

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.

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
  • 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
  • 3
    Huh? !![]+![]? Why not just 4-3? – Timwi Mar 9 '11 at 1:32
  • 4
    @Timwi: More obfuscation – Thomas Eding Aug 5 '11 at 23:06

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 '*')

C: 162 characters (excluding unnecessary newlines)

I opted for readability and transparency when writing this.

a[3],b;main(){b=99
+9;b+=b<<8;b=b<<8|
97|4;b=b<<8|64|8;a
[3^3]=b;b=78+33<<8
;b+=87;b=b<<8|35^3
;b=b<<8|64|47;a[5^
4]=b;b=97+3<<8;b+=
99+9;b=b<<8|66|48;
a[6^4]=b;puts(a);}

It satisfies all three requirements.

  • 1
    I like this, but unfortunately it doesn't satisfy all the rules, because it contains the digit 7, violating rule #3. But it would be easy to get rid of 7. Also by adding a few ints, and adding a few extra parentheses, and adding int puts(int*); to the beginning, it compiles with gcc -ansi -W -Wall only with a single warning: control reaches end of non-void function. – pts Aug 24 '13 at 7:05

PostScript, 41 chars

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

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

  • 1
    you could also run it like: gsnd -q -- filename.ps – luser droog Nov 24 '11 at 3:47

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.)

  • 4
    I read that as Runescape. – Mateen Ulhaq Nov 1 '11 at 23:43
  • @MateenUlhaq I always read it as Runescape, and I only played for a year over a decade ago... What's wrong with me? – Mwr247 Sep 16 '15 at 16:30

Haskell, 38

Constraints 1 and 3 followed.

main=putStr$map succ"G\x64kkn\USVnqkc"

Bash, 24 20 characters

You need to have the "bsdgames" package installed.

rot13<<<Uryyb\ Jbeyq

Thanks gnibbler :)

Your Answer

 

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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