Difference between revisions of "$longip"

From Scriptwiki
Jump to: navigation, search
 
m (now the line breaks get rendered.)
 
Line 17: Line 17:
  
 
==See Also==
 
==See Also==
[[$ip]] To get your local IP address
+
[[$ip]] To get your local IP address<br />
[[$base]] To convert between decimal and hexadecimal
+
[[$base]] To convert between decimal and hexadecimal<br />
 
[[$calc]] To perform calculations
 
[[$calc]] To perform calculations
  
 
[[Category:Identifiers]]
 
[[Category:Identifiers]]

Latest revision as of 22:33, 12 July 2013

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