summaryrefslogtreecommitdiff
path: root/info/challenges/aro-bend/answer.010
blob: 754b29f33212a71a5ee83a326bb49d92b062de18 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
Date: 13 Sep 1993 16:28:51 -0400 (EDT)
From: Michael Downes <MJD@MATH.AMS.ORG>
Subject: Around the Bend #10, answer
To: info-tex@shsu.edu
X-ListName: TeX-Related Network Discussion List <INFO-TeX@SHSU.edu>

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{|}~