$longip

From Scriptwiki
Jump to: navigation, search

Converts an IP address into a long ip address, and a long ip address into a short ip address.

$longip(IP/longip)

The Principal

A long IP address is an integer that represents an ip address. Consider the IP Address 192.168.2.4

$longip(192.168.2.4) = 3232236036

This is equal to (192*256^3)+(168*256^2)+(2*256^1)+(4*256^0)

$calc((192*256^3)+(168*256^2)+(2*256^1)+(4*256^0)) = 3232236036

or C0A80204 (The base 16 value of each byte put together)

$base(C0A80204,16,10) = 3232236036

See Also

$ip To get your local IP address
$base To convert between decimal and hexadecimal
$calc To perform calculations