logoalt Hacker News

jandrese11/07/20241 replyview on HN

IPv6 at least sensibly has a different delimiter for when you are eliding zeros.


Replies

moefh11/07/2024

It's not really about eliding zeros, though. It's kind of a cursed thing:

  x       -> x3.x2.x1.x0
  x.y     ->  x.y2.y1.y0
  x.y.z   ->  x. y.z1.z0
  x.y.z.w ->  x. y. z. w
Where x0 is the 8 least significant bits of x, x1 is the next 8 higher bits, and so on.

The "zeros" happen when the last number is smaller than 256 (or 65536, etc.), but it doesn't have to be. For example 10.258 is a valid way to write an IPv4 address, it's the same as 10.0.1.2.

show 1 reply