# Obfuscated Hello World

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

Here is a Stack Snippet to generate both a regular leaderboard and an overview of winners by language.

/* Configuration */

var QUESTION_ID = 307; // Obtain this from the url
// It will be like https://XYZ.stackexchange.com/questions/QUESTION_ID/... on any question page
var COMMENT_FILTER = "!)Q2B_A2kjfAiU78X(md6BoYk";
var OVERRIDE_USER = 48934; // This should be the user ID of the challenge author.

/* App */

return "https://api.stackexchange.com/2.2/questions/" +  QUESTION_ID + "/answers?page=" + index + "&pagesize=100&order=desc&sort=creation&site=codegolf&filter=" + ANSWER_FILTER;
}

}

jQuery.ajax({
method: "get",
dataType: "jsonp",
crossDomain: true,
success: function (data) {
data.items.forEach(function(a) {
});
comment_page = 1;
}
});
}

jQuery.ajax({
method: "get",
dataType: "jsonp",
crossDomain: true,
success: function (data) {
data.items.forEach(function(c) {
if (c.owner.user_id === OVERRIDE_USER)
});
else process();
}
});
}

var SCORE_REG = /<h\d>\s*([^\n,]*[^\s,]),.*?(\d+)(?=[^\n\d<>]*(?:<(?:s>[^\n<>]*<\/s>|[^\n<>]+>)[^\n\d<>]*)*<\/h\d>)/;

function getAuthorName(a) {
return a.owner.display_name;
}

function process() {
var valid = [];

var body = a.body;
if(OVERRIDE_REG.test(c.body))
body = '<h1>' + c.body.replace(OVERRIDE_REG, '') + '</h1>';
});

var match = body.match(SCORE_REG);
if (match)
valid.push({
user: getAuthorName(a),
size: +match[2],
language: match[1],
});

});

valid.sort(function (a, b) {
var aB = a.size,
bB = b.size;
return aB - bB
});

var languages = {};
var place = 1;
var lastSize = null;
var lastPlace = 1;
valid.forEach(function (a) {
if (a.size != lastSize)
lastPlace = place;
lastSize = a.size;
++place;

.replace("{{NAME}}", a.user)
.replace("{{LANGUAGE}}", a.language)
.replace("{{SIZE}}", a.size)

var lang = a.language;
if (/<a/.test(lang)) lang = jQuery(lang).text();

languages[lang] = languages[lang] || {lang: a.language, user: a.user, size: a.size, link: a.link};
});

var langs = [];
for (var lang in languages)
if (languages.hasOwnProperty(lang))
langs.push(languages[lang]);

langs.sort(function (a, b) {
if (a.lang > b.lang) return 1;
if (a.lang < b.lang) return -1;
return 0;
});

for (var i = 0; i < langs.length; ++i)
{
var language = jQuery("#language-template").html();
var lang = langs[i];
language = language.replace("{{LANGUAGE}}", lang.lang)
.replace("{{NAME}}", lang.user)
.replace("{{SIZE}}", lang.size)
language = jQuery(language);
jQuery("#languages").append(language);
}

}
body { text-align: left !important}

width: 290px;
float: left;
}

#language-list {
width: 290px;
float: left;
}

font-weight: bold;
}

table td {
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<tr><td></td><td>Author</td><td>Language</td><td>Size</td></tr>

</tbody>
</table>
</div>
<div id="language-list">
<h2>Winners by Language</h2>
<table class="language-list">
<tr><td>Language</td><td>User</td><td>Score</td></tr>
<tbody id="languages">

</tbody>
</table>
</div>
<table style="display: none">
</tbody>
</table>
<table style="display: none">
<tbody id="language-template">
</tbody>
</table>

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

# Vim, 31 keystrokes

ia<C-v><C-v>92<esc>22<C-a>SU<C-o>@"yyb Jb<C-v>x65yq<esc>g?g


This was really fun! I'll write an explanation a little bit later.

## Perl 6, 86 bytes

I chose to break the second rule.

my &a={$*IN.gist.substr($_,1)};say a(4)~"e"~a(8)~a(8)~"o "~a(36-9).uc~"or"~a(8)~a(8-1)


Calling gist on $*IN (neither of which has any forbidden characters) gives this string: IO::Handle<IO::Special.new(what => "<STDIN>")>(opened, at octet 0)  So I pieced together parts of this string to get the desired message. There is no capital W, but luckily uc doesn't have any forbidden characters either. # Pushy, 16 bytes Note that this solution is non-competing as the language postdates the challenge. Ifmmp!XpsmeKt"  Try it online! Here's the basic rundown: Ifmmp!Xpsme \ Push these character codes to the stack Kt \ Subtract one from all " \ Print as string  The main string is just Hello, World!, with all its characters moved 1 space up the ASCII table - hence why we subtract 1 from all the character codes. This solution satisfies the first and third criteria - it would even match the second, if not for that single e at the end of the string. ## AWK, 164 bytes #!/bin/awk -f BEGIN{n++ system("awk 'printf(\"%c",$n)}'<<<\""69+3"\n"98+3"\n"36*3"\n"36*3"\n"36*3+3"\n"35-3"\n"84+3"\n"36*3+3"\n"36*3+6"\n"36*3"\n"94+6"\n"6+4"\"")}


Usage: Place the code in a file, FILE, and set the 'executable-bit' to true. Sending a single string input will print Hello World. Multi-line input results in the string being printed once for each line.

Example:

File <<< "42"


Since a program was requested, I assume the code is running on some UNIX-like environment with the awk executable available at /bin/awk. I further assume that /bin is in your path.

Not sure if this really counts as just an AWK program, since it is using the system command, but at least the system call is calling AWK. :)

I do violate the second rule, simply because I couldn't come up with a way around using the printf command. :(

# ><> (Fish), 39 bytes

'Tqxx{,c{~xp'bv
ii*p:?!;{c-þi+>aa*b+b


I wanted to add a shorter solution that does not violate any rules. First line adds each letter of the encoded 'Hello World' and initializes the 'counter'.

The second line loops, outputting the next letter until counter hits 0. The thorn is overwritten with 'o', ><>'s output instruction once every loop, but that doesn't hurt anybody.

To get around the inability to use '1' while saving characters, I used the operation 'i', which tries to read stdin and pushes '-1' to the stack when it finds nothing there.

• I like that you stayed within the rules more so than the earlier one. Jan 17 '17 at 5:54

# PHP, 36 34 bytes

not the shortest PHP answer, but unique enough for a post.

H<?=hhhh3lll^zsspw_gz^wwwwdddd,ld;


and

H<?=hhhh3lll^zsspw_gz^wwwwdddd?>ld


violate rule #1.

There are of course less "violent" operand combinations; but if you must sin, make it worth it!

other versions:

for(;$c="Fkbba.Ya|bj"[$i++];)echo$c^_^Q; # 40 bytes, violates rules #1 and #2 for(;$c="Fkbba.Ya|bj"[$i++];)print$c^_^Q;   # 41 bytes, violates rule #2
<?="Fkbba.Ya|bj"^___________^QQQQQQQQQQQ;   # 41 bytes, no violation
<?=____YzffR__^TQQQF3nnQQQ^Ckbbpi_gqbj;     # 39 bytes, no violation
H<?="kbba.Ya|"^________^QQQQQQQQ,ld;        # 36 bytes, violates rule #1


# Octave, 103 bytes

This one adheres to all three rules and should be fairly obfuscated.

Strings can be created in Octave by concatenating a vector with a string. So, why not concatenate it with the string 'PPCG'? I added ... so that it's possible to read it without scrolling to the side. It can be removed along with the line break.

['PPCG',3336,3848,5384,6664,584,5896,584,869,364,364,3848,364,4463,544,343,343, ...
3336,4463,3954,3948,356]

ans = Hello World


I'll post an explanation for this in one week. Until then, try figuring it out by yourself. Note, this doesn't work on any of the online interpreters I tried, but it works fine on GNU Octave 4.2.0.

• Just curious, do you have any idea why the online interpreters output differently? (I got PPCGHHelllo WWorld from TIO) Jan 27 '17 at 18:25
• I'm guessing they can't handle ASCII control characters, but I'm not sure... Jan 27 '17 at 18:31
• Aah, the famous backspace, nice idea :) Jan 27 '17 at 18:38
• But where's the backspace? :-P Jan 27 '17 at 19:08

# VBScript, 58 Bytes

Only breaks rule 2:

msgbox unescape("%48e%6C%6Co%"&19+1&"%5"&(6+1)&"or%6C%64")


# 05AB1E, 5 bytes (non-competing)

Breaks none of the rules, code:

”Ÿ™‚ï


Uses CP-1252 encoding. Try it online!

• This is invalid. The expected output isn't Hello Dc. You must use ”Ÿ™‚ï instead. Apr 26 '17 at 16:44
• @EriktheOutgolfer Thanks, I have corrected it. Apr 26 '17 at 16:55

Brainf*** (106 characters)

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

• Welcome to PPCG! Nov 11 '17 at 19:53
• BTW, there's an open-ended +500 bounty for anyone beating the current Brainfuck "Hello, World!" record (78 bytes -- with a comma and an exclamation point). Nov 11 '17 at 20:01

# Data URI 28 bytes

data:;base64,SGVsbG8gV29ybGQK

Copy and paste into the browser url bar

# Befunge-93, 24 bytes

9"mu{x)xuunQ">9#,-#$:_@  Try it online! Violates no rules. Simply pushes the text shifted by 9 and subtracts 9 from each character before printing. # Japt, 9 bytes HÁM WŽld  Try it online! The built-in shoco compressor just did the perfect job to remove eor. Alternatively, slightly less obvious: ## 16 bytes "Ifmmp!Xpsme"c_É  Try it online! c maps over the charcodes, and _É is a decrement function. É is a shorthand for -1. # Z80Golf, 21 bytes Contains unprintable bytes, so here's xxd (breaks rule 1): 00000000: 0063 6b71 6e56 1f6e 6b6b 6447 2e0b 7e3c .ckqnV.nkkdG..~< 00000010: ff2d 20fa 76 .- .v  Try it online!  nop ld h, e ; 'Hello World' backwards if you add 1 to each byte ld l, e ; execution falls through ld (hl), c ld l, (hl) ld d, (hl) rra ld l, (hl) ld l, e ld l, e ld h, h ld b, a ld l, loop - 3 loop: ld a, (hl) inc a rst$38
dec l
jr nz, loop
halt


# DOS .com executable: 31 bytes

BE 13 01 AC B4 02 34 FF 88 C2 75 03 80 C4 4A CD
21 EB F0 B7 9A 93 93 90 DF A8 90 8D 93 9B FF


Stores the string byte-inverted, outputs using DOS syscalls. Contains none of the banned characters.

source:

.code16
.org 0x100
start:
movw $str, %si l: lodsb mov$0x02, %ah
xor $0xff, %al mov %al, %dl jnz 1f add$0x4a, %ah
1: int $0x21 jmp l str: .ascii "\xb7\x9a\x93\x93\x90\xdf\xa8\x90\x8d\x93\x9b\xff"  # Runic Enchantments, 39 bytes \> ' '  \+kw+kwb8qn;' 83*´34 f-;@  Try it online! As seen in Notepad++ to better distinguish the non-printing bytes: Violates only rule 1. I had fun computing the first line (a sequence of raw byte values). Alternatively I could have violated rule 2, but I felt that doing so was less obfuscated. There's four different methods used in the 39 byte solution for generating integer values, making it hard to figure out what's going on (compared to just some mathematical operators in the 17 byte solution). 39 byte solution must occupy two lines. # Gol><>, 21 bytes "mu{x)xuunQ"T:Z;9-ot  This is a program that JoKing made, golfing the heck out of it. Try it online! Old version, 37 bytes "Fcjjm"b3+s"Umpjb"c&rT&M:&33-)QPPot|;  This is a really simple, not very creative way of doing this, all it does is just encode everything 2 below their actual ascii encoding, the hardest part is not using 'l', which in gol><> is the length of the stack! Try it online! # naz, 80 bytes 9a8m1o9a9a8a3a1o6a1a1o1o3a1o0m9a4m8a1o9s3s1o3m9s1o9a9a6a1o3a1o6s1o8s1o0m4a8m1a1o  Breaks rule 2 only. # TeX, 39 bytes Meets conditions 1 and 2: ^^48^^%^^,^^,^^/ ^^57^^/^^2^^,^^$\by^^%


Try it online!

# Pxem, 0 bytes (content) + 41 36 bytes (filename).

Inspired by @MD FX.

• Filename (escaped): ayIfmmp!Xpsme?.z\001.-.t.v.m.v.c?.a.s.p
• Content: empty

## What it does

• Push next characters
• Decrement each of them
• Output them finally

Try it online!

41 bytes

## Assembly: 117 source chars, 29 byte .com file

Assemble using A86.

mov si,273
mov ah,2
mov dl,133
lodsb
int 21h
lodsb
jne 266
ret
sbb ax,7
clc
pushf

• I don't have A86. nasm assembles it, but in 31 bytes, and it crashes DOSBox when run.
– J B
Feb 9 '11 at 19:50
• @J B: There's a link to A86 in the post. Feb 10 '11 at 9:13
• This contains the characters 1 and 2 and therefore violates the rules. Maybe you didn’t mean “assembly” but rather machine code and you only posted the assembly representation of it? You need to say this. Otherwise I can just post some C code and say that the entry is the compiled binary... Mar 8 '11 at 20:33
• @timwi: it contains 'h', 'd', 'l', '7', 'e' and 'o' as well. But then you'd be hard pressed to write any assembler code that didn't have those characters. Even the machine codes would have 0,1,2 or 7 somewhere. Mar 8 '11 at 21:49
• I guess that means your entry violates the rules. Sorry. Apr 4 '11 at 10:50

## dc 48

8 9*P101P108P108P111P4 8*P81 6+P111P114P108P100P


One way how to execute:

dc<<<"8 9*P101P108P108P111P4 8*P81 6+P111P114P108P100P"


The solution conforms to the first and the third rule.

C code:

#include
main(){int x=0,y[14],*z=&y;*(z++)=0x48;*(z++)=y[x++]+0x1D;*(z++)=y[x++]+0x07;*(z++)=y[x++]+0x00;*(z++)=y[x++]+0x03;*(z++)=y[x++]-0x43;*(z++)=y[x++]-0x0C;*(z++)=y[x++]+0x57;*(z++)=y[x++]-0x08;*(z++)=y[x++]+0x03;*(z++)=y[x++]-0x06;*(z++)=y[x++]-0x08;*(z++)=y[x++]-0x43;*(z++)=y[x]-0x21;x=*(--z);while(y[x]!=NULL)putchar(y[x++]);}


Output :

Hello, world!


Ruby (42 chars, rules I & III)

puts"\x48e\x6c\x6co #{'V'.succ}or\x6c\x64"

void main(){
int a[100]={4,1,8,8,11,-68,19,11,14,8,0,0,0};
for(;a[13]<a[4];a[13]++)
{
printf("%c",100+a[a[13]]);
}

}


Funny,isn't it?

## XeTeX

Compile with xetex, output is in generated PDF. Of course, this still breaks some of the rules (still uses forbidden digits) and could be obfuscated and compacted a lot more, but I am tired and have to go to bed. Well, maybe you like it anyway :-)

\let~\def
\toksdef\|0
\let\ea\expandafter
~\>{\uppercase{\|\ea{\the\|.}}}
~\.{\uccode.\numexpr32+}
~\u#1{\|{}\ea\v\number#1 \^^J{\iffalse}..\fi\relax}
~\v1#1#2#3#4{\.#1#2\>\.#3#4\>\ea\v\number}
\u{㛵䔌䘣䘾䔄}\the\|
\bye


## Brainfuck, 94 Characters

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


Obvious, being BF it breaks none of the rules.

If I lowercase the output it's only 86, but I don't think that's allowed.

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


The first one is a balanced nested loop generator, the second is a slipping (or sliding) loop generator

NB: The newlines in the code are for this message, they should be removed for running or counting.

# PHP

This is a very cheap trick (30 bytes):

<?=cONSTAnTINO_^'+*"?;a9;;"+'


Not much to see here.

Rules broken: none (the O.P. said o, not O)

Going really cheap on this one (25 bytes):

Create a file called cONSTAnTINO_ and run:

<?=__FILE__^'+*"?;a9;;"+'


There's nothing saying about file names being forbidden.

But if we want to go REALLY dirty, just do (10 bytes):

<?=__DIR__


And run a file from a directory called Hello World.

Enough of being cheap!

Here is another attempt (97 bytes):

<?foreach([144,405,650,867,1114,389,1224,1783,2060,2169,2210]as$k=>$v)echo chr($v/(($k+1*2)+\$k));


Yeah, pretty huge, right?

• You were successful in breaking the second restriction in your first one because the OP mentioned "in any case" (but it's only one restriction, so it's fine). But your second and third ones use a standard (forbidden) loophole and break restrictions 1 and 2. Jul 6 '15 at 1:19
• @KevinBrown Those aren't serious answers. The purpose of those is to show how much I can cut If I go really cheap (a.k.a.: cheat). Jul 6 '15 at 1:28

# Cardinal, 7371 68 chars

>----~n*,n*,n*,,n*,n*v
- xx  Nj kr rx  u  &],
\-%xx,*u,*u,*u,*u ,*u<


My previous, less obfuscated version (73 chars) for better understanding:

>--- ~n*,n*,n*,,n*,n*,n*,n*,n*,n*,n*,
\---%xN  k  r   u  &  ]  u  x  r  j


Start at %, first move to the left, decrement the active value by 3 (---). () reflects the IP upwards, (>) changes the direction to the right. Then decrement by 3 more (---), swap active and inactive value (~). Then read in the char below (n), store it as active value, add the inactive value to it (*) and output the result (,)... rinse and repeat.

‘n’ places the active value of the ip above the arc of the character n, u puts it below the arc of the character u, then picks up the value of the character above (u) or below (n) the “open” side of the letter and stores the value as new active value. The corresponding instructions in horizontal direction are ‘(’ and ‘)’.

Cardinal is an esolang invented in 2010 http://esolangs.org/wiki/Cardinal

The original interpreter has some bugs, but this example works without problems. I recompiled the source to get rid of the worst bugs so far, in case someone is interested.

# Ruby, 66

puts ""<<(61+11)<<101<<108<<108<<111<<' '<<(31+56)<<111<<114<<108<<100


It breaks rule 2

# Ruby, 43

puts "Gdkkn~Vnqkc".split("").map(&:succ)*''