Just wondering about the minimum character count of an IPv4 / IPv6 address in string representation. What's the shortest valid IP address?
1.1. 1.1 would be a valid IP address, so the answer to your question is "7".
The minimum length of an IP header is 20 bytes, or five 32-bit increments. The maximum length of an IP header is 24 bytes, or six 32-bit increments. Therefore, the header length field should contain either 5 or 6.
An IPv4 address is 32 bits. An IP Address is shown as 4 decimal numbers representing 4 bytes: d.d.d.d where d = decimal number (0 - 255).
An IP address is a string of numbers separated by periods. IP addresses are expressed as a set of four numbers — an example address might be 192.158.1.38. Each number in the set can range from 0 to 255.
1.1.1.1
would be a valid IP address, so the answer to your question is "7".
Technically, you can omit the first three octects if the are 0, therefore shortest ipv4 address is one byte, it is "1
", a shorthand for "0.0.0.1
".
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With