Date: 13 Sep 1993 16:28:51 -0400 (EDT) From: Michael Downes Subject: Around the Bend #10, answer To: info-tex@shsu.edu X-ListName: TeX-Related Network Discussion List Answer to 10(a). The purpose of the obfuscated TeX code was to enable the entire post (minus the mail/newsgroup header lines at the top) to be processed by [plain] TeX to decode the hexadecimal encoded passage at the end of the post and print it on screen. The contents of that passage were simply the answers to 10(a) and 10(b). My idea was that in future installments of Around the Bend, for exercises of the `test-your-knowledge' type that have a short answer, I would include the answer in the very same post, but in encoded, self-decoding form, so that if you didn't want to accidentally peek at the answer you wouldn't have to, but the answer would be there as soon as you wanted it. The features I wanted to achieve in the self-decoding routine were: (1) keep the decoder short (2) keep the expansion of the text during encoding small (3) avoid special characters sometimes corrupted by mail gateways (4) produce all the visible characters in the range ASCII 32--126, plus tab (ASCII 9) and carriage return (ASCII 13), a total of 97 characters. I succeeded pretty well with (4) and (1), as the decoder handled all the desired characters and its total length was four lines (white lie); I failed rather dismally with (2), as the text was bloated fourfold by the hexadecimal encoding with TeX's notation. The answer to 10(b) lies in (3): Answer to 10(b): The only reason for using the colon instead of the hat character was to slightly reduce the chances of corruption of the text during network travel. Donald Arseneau and Peter Schmitt both furnished nice de-obfuscating analyses of the obfuscation. Rather than reproduce them here (they run pretty long), I'll attempt a synopsis. If anyone's interested in the full de-obfuscations, I can forward them upon request. Synopsis: The text at the end of the post with lots of double colons is hexadecimal-encoded, using category 7 colon instead of the more usual category 7 hat (^) for TeX's special character notation. The goals are: (1) Skip over the clear text part at the top of the post. (2) Take the encoded text at the bottom of the post and write it on screen. Since the clear text part could, in general, include arbitrary TeX code, we skip over it with \iffalse ... \fi and do some disabling of backslash, ^^L, and certain other things. (The closing \fi is written with an alternate escape character, &, instead of backslash, and a more unusual name, &Answr, is substituted, for reasons too complicated to go into here.) Because the encoded text also could include TeX code, it is first read into a token register, so that it can be written on screen by \write without getting unwanted expansion. Catcodes of a few special characters \ { } % ~ and space are changed just before the token register assignment, to keep them from fouling up the verbatim repetition of the text on screen. Michael Downes %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% mjd@math.ams.org (Internet) ASCII 32--54,55--126: !"#$%&'()*+,-./0123456 789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~