July 16, 2026

Small format, huge comment energy

DJB Netstrings

The tiny text format that had coders cheering, nitpicking, and roasting old-school C

TLDR: Netstrings are a simple 1997 way to label data by putting its size first, which helps programs avoid dangerous mistakes. Commenters were split between admiring the clean idea, roasting the ancient code style, and arguing over whether the design is brilliantly minimal or oddly overcomplicated.

A 1997 note from cryptography and programming legend Daniel J. Bernstein just dropped readers into a wonderfully nerdy time capsule: netstrings, a super simple way to package text so the size is written first, then the text, then a comma. In plain English, it’s a neat little labeling trick meant to make sending data safer and easier. Bernstein’s pitch was straightforward: if you know how big the message is before reading it, you’re less likely to blow up your program with sloppy code. And yes, he even dragged an infamous old security disaster to make the point.

But the real fireworks were in the comments, where the mood swung from "this is clean and sensible" to "wait, this may be simple, but is it too cute?" One early reaction, "(1997) -DJB", basically joked that the year alone explains the whole vibe: minimalist, blunt, and unapologetically C-language. Another commenter praised it as exactly what you’d expect from Bernstein — coherent and practical — then immediately asked the classic internet question: did anyone actually use this?

That opened the floodgates. One camp brought up spin-offs like tagged netstrings, a remix that tries to cram in numbers, lists, and other data types. Another camp zeroed in on the sample code and practically winced at the old-school error handling, treating it like a museum exhibit from a rougher programming era. Then came the skeptic’s hot take: why is the part that says the length allowed to be variable too? That complaint sparked the thread’s biggest eye-roll debate — elegant minimalism or unnecessary cleverness? In other words: the format is tiny, but the comment drama was deliciously oversized.

Key Points

  • The article defines a netstring as a self-delimiting encoding of a byte string using the format `[len]:[string],`.
  • Netstrings are designed to be easy to generate and parse, while declaring the string length up front for advance bounds checking.
  • The document says netstrings can serve as a building block for reliable network protocols and can be nested recursively.
  • The specification requires a nonempty decimal ASCII length field with no leading zeros except for the empty string, encoded as `0:,`.
  • Sample C code demonstrates encoding and decoding, and the security section argues netstrings can reduce buffer-overflow risk compared with CRLF-terminated parsing.

Hottest takes

"(1997) -DJB" — gnabgib
"Ah, the wonders of error-handling" — Joker_vD
"an unnecessarily risky complication" — weinzierl
Made with <3 by @siedrix and @shesho from CDMX. Powered by Forge&Hive.