One of my favorite languages is PostScript. It’s not so much the language itself — it’s simple and general but it can be a bit of a hassle to use — but the idea to use a general programming language as a document format. I’ve been playing around a bit lately and have written two small PostScript programs that can transform PS documents: munch-rot13.ps and munch-nl.ps. The one script ROT13s the document (example) and the other one simply swaps the letter N and the letter L (example). The N/L thing is sort of a tradition at daimi.

How do you “run” the programs? You simply concatenate the program with the document you want to transform. To apply ROT13 to document.ps you simply write

$ cat munch-rot13.ps document.ps > document-rot13.ps

You can apply the transformations as many times as you want so given a document encoded with munch-rot13.ps you can decode it by just applying munch-rot13.ps again. And, incidentally, if want to decode a document but don’t have munch-rot13.ps, don’t worry: since the document was encoded by appending it to the script, the encoded document actually carries around the script.

You can also mix the transformations: apply ROT13, then N/L and then ROT13 again. That causes A and Y to be switched in the document.

Pointless? Maybe, but I thought it was an interesting challenge. And, as Mayer Goldberg demonstrates, you can actually write useful programs in PostScript. Maybe I’ll try that some day. I’m not completely done with pointlessness yet, though: I’m considering writing a version that Enigmas the document.

5 Responses to CbfgFpevcg

Leave a Reply

Your email address will not be published. Required fields are marked *