📜 ⬆️ ⬇️

Alternative way to write IP addresses

Probably, some people know such a thing, but I think, far from all.

As we all know, an IPv4 address is a 32-bit number. Traditionally, an IP address is written as 4 octets, separated by a dot, in decimal notation. For example: 77.88.21.8 .
However, there are other, less common recording options.

First, each of the 4 octets can be written in octal or hexadecimal number systems:
77.88.21.8 = 0x4d.0x58.0x15.0x8 = 0115.0130.025.010 , or you can even mix 77.88.0x15.010 .
')
Secondly, the address can be written as a number:
77 * 256 3 + 88 * 256 2 + 21 * 256 1 + 8 * 256 = 1297618184 .
Similarly to item 1, this number can be written in octal and hexadecimal number systems: 1297618184 = 011526012410 = 0x4D581508 .

Honestly, I did not find an RFC that describes these formats, but it works everywhere: in the browser, the ping command, etc. Try it yourself.

Source: https://habr.com/ru/post/69587/


All Articles