10 digit decimal IP addresses – How to

There is a little known quirk in the Internet Explorer and Firefox browsers.  Here’s an example link to Google: http://1249710995.  If clicking it doesn’t work for you, copy and paste it into IE6 or 7 or FF3. (I haven’t tested any other browsers except for Opera and Chrome, neither of them work.)

I wrote a quick converter in PHP, you can play with it here and download the source code on the same page.

How to: Convert each octet of an IPv4 address to hex and concatenate the hex values into one giant number. Convert the number back to decimal and you have the 10 digit number.

Quick reference conversion functions:

IP Address to 10 digit:

	function toTen($i){
		$a = explode(".",$i);
		$g1 = $a[0];
		$g2 = $a[1];
		$g3 = $a[2];
		$g4 = $a[3];
		
		$g1 *= 16777216;
		$g2 *= 65536;
		$g3 *= 256;
		
		return $g1 + $g2 + $g3 + $g4;
	}

10 digit back to IP:

	function toIP($i){
		$i = dechex($i+0);
		$g1 = hexdec(substr($i,0,2));
		$g2 = hexdec(substr($i,2,2));
		$g3 = hexdec(substr($i,4,2));
		$g4 = hexdec(substr($i,6,2));
		
		return $g1.".".$g2.".".$g3.".".$g4;
	}

Why: Anonymity.  I can’t think of a use for this that isn’t potentially malicious.  It could be used by malware to trick users into going to an unfriendly url, and bypass blacklisted domain names in spam filters.

I’m sure the feature is put there for a reason, I’m just not sure what it is.  Got any ideas?

Leave a Reply