one year on
OpenAI is shockingly good at unminifying code
A developer finds that ChatGPT can reverse-engineer minified JavaScript and produce human-readable, working code — a use case the author says he had not considered before.
August 29, 2024 — A developer discovered that OpenAI’s ChatGPT can reverse-engineer minified JavaScript and produce human-readable code, a use case that surprises some developers on Hacker News.
The experiment began when punkpeye, a developer, encountered a minified JavaScript component and instead of manually decoding it, pasted the code into ChatGPT. The model returned a detailed explanation and a TypeScript implementation that was not only readable but functionally equivalent to the original.
On Hacker News, the story quickly gained 931 points and 304 comments. Developers debated the reliability of LLMs for this task. Some praised the approach, while others, like jehna1, the author of HumanifyJS, argued that using LLMs at the AST level with traditional tools ensures correctness. Lifthrasiir cautioned that while minification is invertible, intentional obfuscation remains challenging.
The thread turns into a discussion of LLMs as reverse-engineering aids, with some commenters saying they will try the technique for code review and learning.
The record
Original author updated the post to link to HumanifyJS after a community member shared it.
Author of HumanifyJS, a tool that uses LLMs on AST level to unminify code, noting their approach uses LLM for naming but ensures correctness via Babel.
Argued that JS minification is mechanical and inversion easier than general unobfuscation, citing their own experience with GPT-4 failing on intentionally obfuscated C code.
One year later — open only if you can handle spoilers
HumanifyJS and similar tools became widely used in the security community. The approach of combining LLMs with AST-level analysis proved more reliable than pure LLM unminification. However, LLMs alone still struggle with heavily obfuscated code.
The Weekly Replay · free by email
This week, one year ago — every Sunday.
One email each Sunday: the week's replayed AI news, with the one-year-later annotations included. Written like it's breaking — dated like it isn't.
Free · double opt-in · unsubscribe anytime · privacy