Obfuscated random memories
Oct. 19th, 2004 09:24 am![[personal profile]](https://www.dreamwidth.org/img/silk/identity/user.png)
I'm reminded, from a little chat on Bryant's lj regarding obfuscated perl, that the most obfuscated program I've ever seen was written in BASIC on a TRS-80.
About thirty lines of code. The thing was, the first line was ON ERROR GOTO, and the rest of the program was mostly illegal instructions of one sort or another, sprinkled with a few valid data statements, random memory POKEs, and reassignments of the ON ERROR. The error-handler routine itself rewrote the ON ERROR GOTO, but somewhere in there it was using the error code as a multiplier to some other variable.
It printed out some word that I don't recall. There were no actual print statements in the program; it was writing a set of BASIC-interpreter codes into memory and then executing them, and the code it wrote was generated from the various sorts of syntax errors, division by zeroes, type mismatches, and other errors that occured from executing the actual source.
It also couldn't be LISTed, because among the embedded strings were ASCII codes to clear the screen.
Spent a good week figuring that one out. Got it out of my system. Maybe that's why I have no interest in learning all these obfuscated-perl tricks ... been there, done that.
About thirty lines of code. The thing was, the first line was ON ERROR GOTO, and the rest of the program was mostly illegal instructions of one sort or another, sprinkled with a few valid data statements, random memory POKEs, and reassignments of the ON ERROR. The error-handler routine itself rewrote the ON ERROR GOTO, but somewhere in there it was using the error code as a multiplier to some other variable.
It printed out some word that I don't recall. There were no actual print statements in the program; it was writing a set of BASIC-interpreter codes into memory and then executing them, and the code it wrote was generated from the various sorts of syntax errors, division by zeroes, type mismatches, and other errors that occured from executing the actual source.
It also couldn't be LISTed, because among the embedded strings were ASCII codes to clear the screen.
Spent a good week figuring that one out. Got it out of my system. Maybe that's why I have no interest in learning all these obfuscated-perl tricks ... been there, done that.