Obfuscated Hello World
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).
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;
}
}
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 |%|