Diels-grabsch2: Self Hashing C Program (2019)

C code prints its own “fingerprint” — cue confusion, praise, and side‑eye

TLDR: A tiny C program prints its own SHA‑512 fingerprint using a self-referential trick, not broken crypto. Comments split between confusion (binary vs source hash) and applause for the clever stunt, sparking a lively debate over what “self‑hashing” really means and why this puzzle is cool.

The internet did a double take after a tiny C program claimed it prints its own SHA‑512 “fingerprint” — think a super-long digital ID number. The author swears no cryptography was harmed; it’s a sneaky quine trick, a program aware of its own text, rerouted to print its hash instead. Cue the comments: one early reaction expected it to hash the compiled app, not the source file, setting off a mini turf war over what “self‑hashing” even means. Fans are calling it artful misdirection; skeptics call it a party trick with extra steps. The judges’ cheeky warning — “stay calm… are you dreaming?” — became an instant meme, with replies riffing on simulation jokes and “we need to go deeper” Inception gifs. Explainers popped up for newcomers: SHA‑512 is a fingerprint, a quine prints itself, and this code hides the hashing bits in plain sight. Purists debated “is it really self if the state is precomputed?” while pragmatists clapped for the elegance and portability. Meanwhile, the ultimate vibe: delightfully confusing, meticulously clean, and just cryptic enough to feel like a magic trick. Whether you call it genius or gimmick, the thread is living for the brain‑teaser energy.

Key Points

  • A C program by Volker Diels‑Grabsch prints its own SHA‑512 hash and includes build/run and verification instructions.
  • The approach is quine-based: the program knows its own source and prints its SHA‑512 hash rather than the source.
  • Precomputation encodes the SHA‑512 internal state for the preceding 1280 bytes, a multiple of the 1024‑bit block size, into a trailing string literal.
  • At runtime, the program continues from the precomputed state, processes the final block, finalizes, and prints the hash.
  • The implementation is portable C99, compiles cleanly with GCC/Clang under strict warnings, and obfuscates SHA‑512 identifiers and constants.

Hottest takes

"I thought it would print the hash of its binary :/" — casey2
Made with <3 by @siedrix and @shesho from CDMX. Powered by Forge&Hive.