Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Hi HN,

I built a small Python helper called bit-parser for decoding and encoding compact bitfields (status bytes, flags, small counters) into human-readable structures β€” and back again.

It’s aimed at embedded / IoT / protocol-heavy systems where devices emit short hex strings, but humans need to reason about individual bits, ranges, and meanings.

Repo: https://github.com/vitalij555/bit-parser

The problem

In many protocols, a single byte (or two) encodes multiple independent signals:

boolean flags

RFU / reserved bits

small counters

mode selectors

multi-bit values with constrained ranges

Typical solutions end up as:

scattered masks and shifts

duplicated logic across CLI tools, tests, and UIs

decode-only helpers with no clean reverse operation

frontend teams re-implementing the bit layout by hand

I wanted something small and declarative, where:

the bit layout is defined once

decoding and encoding are symmetric

the same definition can drive CLIs, validation, and UI calculators



Consider applying for YC's Winter 2027 batch! Applications are open till November 2.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: