We are currently working on new rules for what content should and shouldn't be allowed on this website, and are looking for feedback! See Esolang:2026 topicality proposal to view and give feedback on the current draft.
Trapdoor
Trapdoor is an esoteric programming language whose underlying language is JavaScript, with one additional rule: a program is only valid, and only runs, if its source code, read as a single enormous integer, is a multiple of a secret prime number chosen by the language's designer.
The designer publishes a semiprime N = p × q and a validator that checks source code against it. The two factors p and q themselves are never published. To write a program by the "intended" method, you must first factor N to recover p, for any reasonably-sized N, a famously hard problem, and the same one that keeps RSA encryption secure.
Language
Trapdoor programs are plain JavaScript. Semantically, a Trapdoor program does whatever the equivalent JavaScript would do. The only added constraint is validity:
- Take the program's source code as a sequence of bytes.
- Read those bytes as one big-endian integer, most significant byte first.
- The program is valid if and only if that integer is evenly divisible by
p.
Invalid programs are simply refused; they do not run at all, partially or otherwise.