From The Hacker News

  • nul9o9@lemmy.world
    link
    fedilink
    arrow-up
    15
    ·
    11 months ago

    Interesting, I didn’t know IPv4 addresses converted to hex could be used for anything.

    • PowerCrazy@lemmy.ml
      link
      fedilink
      arrow-up
      13
      arrow-down
      4
      ·
      edit-2
      11 months ago

      Dotted Decimal is just a human convention. IPs are just 32 bit numbers meaning binary digit, and octal, dotted decimal and Hex are all valid representations of that same number. Subnet masks work via binary math.

      Almost every single thing you would use an IP address for, you can substitute dotted decimal for octal or hex representations.

    • bfg9k@lemmy.world
      link
      fedilink
      arrow-up
      1
      ·
      11 months ago

      We have PABXes that use VxWorks and it uses hex IPs to identify each ethernet port

      Might be easier to use with lower-level stuff like pure C?

      • maiskanzler@feddit.de
        link
        fedilink
        arrow-up
        4
        ·
        edit-2
        11 months ago

        Nah, it’s easier in pretty much every language. It’s just a 32 bit number that can be compared with a standard “<=” or “=” comparison operator in pretty much every language out there and a single ASM instruction. Writing it as four smaller numbers joined with dots is just how it’s easy to display for humans.

        Many make the mistake of thinking that IPv4 addressess are always encoded like that. The address “127.0.0.1” is just 2130706433 in decimal. Some tools even accept misformed addresses like “0.0.0.2130706433”. Security concerns come in to play when a program checks for local addresses by comparing the individual “127”, “0”, “0”, “1” parts (or eg. “192”, “168”, ““, ,””) and allow or deny access based on that for example. Another part of the software will likely just accept a misformed address and a malicious actor can circumvent the filtering from earlier.

        • giacomo@lemm.ee
          link
          fedilink
          arrow-up
          1
          ·
          11 months ago

          Some tools even accept misformed addresses like “0.0.0.2130706433”

          Is that because it’s just three octets of zero bits? What tools do this?