{"slug": "using-claude-to-decrypt-carmageddon", "title": "Using Claude to decrypt Carmageddon", "summary": "A developer used Anthropic's Claude to decrypt the encrypted car data files from the 1997 game Carmageddon, initially failing when asking the LLM to guess the cipher but succeeding after directing it to find and explain the real encryption code from the dethrace decompilation project. A known plaintext value (\"GENERAL.TXT\" decrypting to \"0.01\") was crucial for resolving endianness ambiguity. The developer then built an extractor in Node.js to parse the decrypted files.", "body_md": "I used to play Carmageddon with [@edulazaro](https://dev.to/edulazaro) and we decided to play it again now that the new one is coming this year.\n\nWe also tried to add new cars, and we wanted their numbers to sit in a sane range: mass, top speed, suspension, etc.\n\nThe 1997 original is the obvious reference. But there is one problem. Carmageddon stores all of that **encrypted** on disk. So for example `CARS/BLKEAGLE.TXT`\n\nis just encrypted garbage.\n\nSo at first just asked Claude to work out the cipher, but it didn't work. We fed it encrypted files expecting frequency analysis, patterns, a simple XOR. Nothing worked.\n\nThre was a 16-byte key, an index starting at `length % 16`\n\nand advancing by 7, tabs remapped to `0x9f`\n\n, and a second key that kicks in as soon as a `//`\n\ncomment appears. You don't guess that from staring at bytes. The thing is that when you ask an LLM to guess something that can only be known, it will hand you something wrong.\n\nFound the repo [dethrace](https://github.com/dethrace-labs/dethrace) exists, a decompilation of the game. The real code is in there. So I changed the question from \"guess this\" to \"find this and explain it to me\". So Claude located the `EncodeLine`\n\nin `src/DETHRACE/common/utility.c`\n\nand translated the C logic to JavaScript.\n\nBut all attempts where bugged. The [endianness](https://es.wikipedia.org/wiki/Endianness) of the key, and what settled it was a comment in `utility.c:125`\n\nsaying `GENERAL.TXT`\n\nmust decrypt to `0.01`\n\n. Big-endian produced that, little-endian didn't. Without a known value to check against, we'd still be picking between equally convincing variants.\n\nWith all 41 cars decrypted, We wrote an extractor that read fields by position: line 12 is the mass, line 15 is the gear count, etc. But the numbers came out absurd. A car with a top speed of 4 and 200 gears.\n\nThe files come inthree format versions (v2, v3, v4) with different fields, so reading positionally shifts the columns in some files and not others. The worst part is that it doesn't fail. It just gives you numbers, and some of them even look reasonable. The fix was to locate each value by its comment text, which you more or less know in advance, since every line carries its `// mass in tonnes`\n\n, etc, and seems stable across versions.\n\nIn genreal, it seems very useful in decryption to find a known value before writing the code, as that `0.01`\n\nwas worth more than\n\nany amount of reasoning about endianness.\n\nHere is the [extractor](https://github.com/edulazaro/carmageddon-extractor) in plain Node/JS.\n\nAnd that's it 😊", "url": "https://wpnews.pro/news/using-claude-to-decrypt-carmageddon", "canonical_source": "https://dev.to/esmesm/using-claude-to-decrypt-carmageddon-dkk", "published_at": "2026-07-26 23:14:49+00:00", "updated_at": "2026-07-26 23:31:56.756732+00:00", "lang": "en", "topics": ["artificial-intelligence", "large-language-models", "developer-tools"], "entities": ["Anthropic", "Claude", "Carmageddon", "dethrace", "Node.js"], "alternates": {"html": "https://wpnews.pro/news/using-claude-to-decrypt-carmageddon", "markdown": "https://wpnews.pro/news/using-claude-to-decrypt-carmageddon.md", "text": "https://wpnews.pro/news/using-claude-to-decrypt-carmageddon.txt", "jsonld": "https://wpnews.pro/news/using-claude-to-decrypt-carmageddon.jsonld"}}