explanation

  • 6th September 2021

Let the music play

char a;float b,c;main(d){for(;d>2e3*c?c=1,scanf(" %c%f",&a,&c),d=55-a%32*9/5,
b=d>9,d=d%13-a/32*12:1;a=2)++d<24?b*=89/84.:putchar(a=b*d);}

Good news for all International Obfuscated C Code Contest fans -- here's another winning piece from 2013 written by Yusuke Endoh, who is no stranger to the Contest. It is dubbed the Most Tweetable 1-Liner, because is small enough to fit in a tweet (137 characters only), yet can "tweet out a tune", that is, will play some music for your entertainment.

Read more 
  • 15th August 2018

Dots and Dashes

#!perl -p
y/.-/01/;s#\d+/?#substr'01etianmsurwdkgohvf,l.pjbxcyzq',31&oct b1.$&,1#ge

Perl is (in)famous for the ability to write programs that look like line noise, and today I will take apart this beautiful piece of code. Written by tybalt89, it can decode sequences of dots and dashes to Latin letters in just 73 characters of code.

Read more 
  • 13th March 2018

Anatomy of the heart

#!/usr/bin/perl -w
use strict;

     my$f=           $[;my
   $ch=0;sub       l{length}
 sub r{join"",   reverse split
("",$_[$[])}sub ss{substr($_[0]
,$_[1],$_[2])}sub be{$_=$_[0];p
 (ss($_,$f,1));$f+=l()/2;$f%=l 
  ();$f++if$ch%2;$ch++}my$q=r
   ("\ntfgpfdfal,thg?bngbj".    
    "naxfcixz");$_=$q; $q=~
      tr/f[a-z]/ [l-za-k] 
        /;my@ever=1..&l
          ;my$mine=$q
            ;sub p{
             print
              @_;
               }
                         
       be $mine for @ever 

This heart-shaped program is written in the language of choice for producing unreadable and obfuscated code: Perl 5. It also serves an unusual purpose of a proposal.

Read more 
  • 1st March 2018

Have fun with Unix

main() { printf(&unix["\021%six\012\0"],(unix)["have"]+"fun"-0x60);}

Just one line of code, but lots of confusion.  What does this program do?

Read more 
  • 18th February 2018

Some are more equal than others

"And to avoid the tedious repetition of these words: is equal to: I will set as I do often in work use, a pair of parallels, or Gemowe lines of one length, thus: =, because no 2 things, can be more equal." -- Robert Recorde, The Whetstone of Witte (1557)

public class Equality {
	public Equality() {
		Integer a1 = 100, a2 = 100;
		Integer b1 = 200, b2 = 200;
		if (a1 == a2) System.out.println("a1 == a2");
		if (b1 == b2) System.out.println("b1 == b2");
	}
	public static void main(String[] args) {new Equality(); }
}
Read more 
  • 20th January 2018

How to dismantle a compiler bomb

main[-1u]={1};

You have heard of "zip bombs" (a tiny ZIP file that decompresses to multiple gigabytes) and "XML bombs" (small XML file abusing the entities to consume lots of memory), and now there is a "compiler bomb" to follow suit.  The idea is quite similar -- the source code is only 14 bytes, but the generated executable will be over 16 GB in size.

Read more 
  • 25th October 2017

Namaste India

This obfuscated piece of C code prints the map of India to the standard output.

#include <stdio.h>
main()
{
    int a,b,c;
    int count = 1;
    for (b=c=10;a="- FIGURE?, UMKC,XYZHello Folks,\
    TFy!QJu ROo TNn(ROo)SLq SLq ULo+\
    UHs UJq TNn*RPn/QPbEWS_JSWQAIJO^\
    NBELPeHBFHT}TnALVlBLOFAkHFOuFETp\
    HCStHAUFAgcEAelclcn^r^r\\tZvYxXy\
    T|S~Pn SPm SOn TNn ULo0ULo#ULo-W\
    Hq!WFs XDt!" [b+++21]; )
    for(; a-- > 64 ; )
    putchar ( ++c=='Z' ? c = c/ 9:33^b&1);
    return 0;
}
Read more 
  • 7th October 2017

Regex prime checker

This Java snippet uses a regular expression for something way different than they were designed for: a primality check.

public static boolean prime(int n) {
    return !new String(new char[n]).matches(".?|(..+?)\\1+");
}
Read more 
  • 11th September 2017

Quine - a self-replicating program

Quines are computer programs that accept no input and write its own source code on the standard output.  This entry was taken from the Jargon File, the author is unknown.

char*f="char*f=%c%s%c;main()
{printf(f,34,f,34,10);}%c";
main(){printf(f,34,f,34,10);}
Read more 
  • 27th August 2017

Underscore Pi

This clever program written by Brian Westley calculates π by looking at its own area.  It is one of the winning entries of IOCCC in 1988.

#define _ -F<00||--F-OO--;
int F=00,OO=00;main(){F_OO();printf("%1.3f\n",4.*-F/OO/OO);}F_OO()
{
            _-_-_-_
       _-_-_-_-_-_-_-_-_
    _-_-_-_-_-_-_-_-_-_-_-_
  _-_-_-_-_-_-_-_-_-_-_-_-_-_
 _-_-_-_-_-_-_-_-_-_-_-_-_-_-_
 _-_-_-_-_-_-_-_-_-_-_-_-_-_-_
_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
 _-_-_-_-_-_-_-_-_-_-_-_-_-_-_
 _-_-_-_-_-_-_-_-_-_-_-_-_-_-_
  _-_-_-_-_-_-_-_-_-_-_-_-_-_
    _-_-_-_-_-_-_-_-_-_-_-_
        _-_-_-_-_-_-_-_
            _-_-_-_
}

Read more 
  • 24th August 2017

Duff's device

"This code forms some sort of argument (...), but I'm not sure whether it's for or against."

send(to, from, count)
register short *to, *from;
register count;
{
	register n = (count + 7) / 8;
	switch (count % 8) {
	case 0: do { *to = *from++;
	case 7:      *to = *from++;
	case 6:      *to = *from++;
	case 5:      *to = *from++;
	case 4:      *to = *from++;
	case 3:      *to = *from++;
	case 2:      *to = *from++;
	case 1:      *to = *from++;
			} while (--n > 0);
	}
}
Read more