Inspired by...
Networking - How can I work out how many IP addresses there are in a given range?
Write a program or function that takes two strings as input, each being an IPv4 address expressed in standard dotted notation and outputs or returns the number of IP addresses covered by this range, including the two IP addresses input.
- You must not use any external code, libraries or services designed to parse an IP address. (Other string processing standard library functions are acceptable.)
- All 2^32 IP addresses are equal. No distinction is made to broadcast, class E, etc.
- Normal code-golf rules apply.
For example:
"0.0.0.0","255.255.255.255" returns 4294967296.
"255.255.255.255","0.0.0.0" also returns 4294967296.
"1.2.3.4","1.2.3.4" returns 1.
"56.57.58.59","60.61.62.63" returns 67372037.
"1","2" is invalid input. Your code may do anything you like.