Esoteric source code

since: 2007-08-27 update: 2009-07-22 count:

Writing obfuscated code is fun.

Golfed binaries

I created other page .

Polyglots

Polyglot quine

Polyglot Quine in C and Ruby and Python and Perl and Brainfuck .

In other words, this program is runnable with 5 language implementations and it produces its source code without file I/O.

Source code .

You can use this source code like following:

> gcc -xc <(./BFI <(python <(ruby <(perl poly_quine5.txt))))
> diff poly_quine5.txt <(./a.out)
>

without Brainfuck version .

See also readable polyglot hello .

> perl poly_hello.txt
Hello, Perl world!
> ruby poly_hello.txt
Hello, Ruby world!
> python poly_hello.txt
Hello, Python world!
> gcc -xc poly_hello.txt && ./a.out
Hello, C++ world!
> ./befunge.rb poly_hello.txt
Hello, Befunge world!
> ./BFI poly_hello.txt
Hello, Brainfuck world!

Symbolic polyglot quine

Symbolic (the program should not use [a-zA-Z0-9] and binaries. I didn't use whitespace characters as well for this case) Polyglot Quine in Ruby and Perl and JavaScript .

Source code .

Note that you can use SpiderMonkey , Firefox , Chrome , and Safari as the engine of JavaScript (IE is not supported). For browsers, it should output the code via alert(). Run the polyglot in this browser .

Polyglot in Brainfuck & Whitespace & Befunge & ELF binary

Linux binary , produced by the code using NASM.

You can run Hello, world! in 4 ways.

Polyglot in C & Brainfuck & Whitespace

Source code .

It has 5 meanings:

References

Symbolic quine in Perl

103Byte symbolic quine in Perl. I defined "symbol" as [\n !"#$%&'()*+,-./:;<=>?@[\]^_`{|}~].

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

)=~('
_ ^-^,'^'"`[;[?@($;^$^)})')

See also: symbolic quine in Ruby .

sed quine

sed quine .

compile time quine in D

compile time quine in D .

Bianry related

Brainfuck compiler in sed

bfx.sed .

It compiles brainfuck code into linux ELF binary.

ASCII binary

This code runs on x86.

char main[]="`j X$@P[PYPPPPX4.4 PZUX, P^XH,=)F(P_X3F()8)8@)8@@)8)8@PYX@@@@CQBaGHello, world!\n";

The following code may be also interestring.

main=195;

Here is my description in Japanese .

Pseudo union

int main(){
    char a[4];
    char b[0x3fffffff];
    char c[0x3fffffff];
    char d[0x3fffffff];
    char e[0x3fffffff];
    int f = 0;
    printf("%x %x %x %x\n", a[0],a[1],a[2],a[3]);
    f = 0x12345678;
    printf("%x %x %x %x\n", a[0],a[1],a[2],a[3]);
    return &f;
}

Others

Hello, world in Perl

''=~('(?{'.('[[).[|`%,,/`[/[@$'^'+)@@/^(@@@@@,@),@').'!
"})')

cal(1) in Brainfuck

cal.bf

> echo 2007 12 | ./BFI ~/cal.bf
                   1
 2  3  4  5  6  7  8
 9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31

Fast brainfuck interpreter

bfopt.ml

It compiles brainfuck code into intermediate format and executes it.

small "Hello, world" in Whirl

768Byte Hello, world! in Whirl . This code is smaller than the previous record .

Source code .

The record was beaten by yowa .


home / index

shinichiro.hamaji _at_ gmail.com / shinichiro.h