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.

Continue reading

Advertisements

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(); }
}

Continue reading

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.

Continue reading

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;
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;
}

Continue reading