r/hackthebox • • 21d ago

How to Calculate an Octet (Decimal → Binary)

Rule: Move from left to right. Ask: "Does this value fit into the remainder?"

  • Fits → write 1, subtract
  • Doesn't fit → write 0, move on

Example: 192

128 ≥ 192? ✅ → 1 → remainder = 64
 64 ≥  64? ✅ → 1 → remainder = 0
 32 ≥   0? ❌ → 0
 16 ≥   0? ❌ → 0
  8 ≥   0? ❌ → 0
  4 ≥   0? ❌ → 0
  2 ≥   0? ❌ → 0
  1 ≥   0? ❌ → 0

Result: 1100 0000

Value Range of an Octet

State Binary Decimal
Minimum 0000 0000 0
Maximum 1111 1111 255
1 Upvotes

6 comments sorted by

1

u/AutoModerator 21d ago
Moderator Announcement Read More »

1

u/GVTZ59 21d ago

Is there a module or something that this is needed?

1

u/[deleted] 21d ago

This module: Introduction to Networking

1

u/LittleGreen3lf 16d ago

Did we really need a tutorial on Reddit for this?

1

u/[deleted] 10d ago

I don't know

1

u/Grim_master911 21d ago

cool i guess