Skip to content

Instantly share code, notes, and snippets.

@uoryon
Last active September 2, 2015 01:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save uoryon/08f82d67d84f8ce365f7 to your computer and use it in GitHub Desktop.
Save uoryon/08f82d67d84f8ce365f7 to your computer and use it in GitHub Desktop.
var ipToInt = function ipToInt(ip) {
var int = 0, i = 0;
ip = ip.split('.');
while (i <= 3) {
int += ip[i] * Math.pow(256, 3 - i);
i++;
}
return int;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment