summaryrefslogtreecommitdiff
path: root/doc/context/third/enigma/enigma_manual.tex
blob: efb4fe2c256d762047b94929e0a8df4363fb9ceb (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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
\startdocchapter[title=Usage]

\startdocsection[title=Loading the Module/Package]
  \TODO{instuctions for plain, latex + ctx}
\stopdocsection

\startdocsection[title=Basic Functionality]

Encrypt the text of your document using the script interface. For
a start try out the settings as given in below listing.

\starttyping
mtxrun --script mtx-t-enigma                    \
       --setup="other_chars = ok,               \
                day_key = B I II III 01 01 01,  \
                rotor_setting = xyz,            \
                verbose=0"                      \
       --text="Gentlemen don’t read each other’s mail, Mr. Turing\!"
\stoptyping

This will result in the thoroughly scrambled string
\type{omribshpwfrfjovkntgqgiabbkhjpxmhdztapkatwrvf}.
Then, use the same settings you encrypted the text with in your
document.

\startcontexttyping
\usemodule[enigma]
\defineenigma [secretmessage]
\setupenigma  [secretmessage] [
  other_chars = ok,
  day_key = B I II III 01 01 01,
  rotor_setting = xyz,
  verbose=3,
]

\starttext

\startsecretmessage
  omribshpwfrfjovkntgqgiabbkhjpxmhdztapkatwrvf
\stopsecretmessage

\stoptext
\stopcontexttyping

If you compile this document with \CONTEXT, the plain text will
reappear.
Notice that punctuation is substituted with the letter “x” before
encryption and that spaces are omitted.

\stopdocsection

\startdocsection[title=Uses and Abuses]

In \LUATEX, \identifier{callback}s may stack. This allows filtering the
input through many enigma machines successively. For instance, in the
following listing, two instances of the same machine are generated and
applied.

\startcontexttyping
\usemodule[enigma]              %% load the module
\defineenigma [secretmessage]   %% generate and
\setupenigma  [secretmessage] [ %% configure a machine
  other_chars = ok,
  day_key = B IV V II 01 01 01 AD CN ET FL GI JV KZ PU QY WX,
  rotor_setting = foo,
  verbose=3,
]

%% now, copy the first machine’s settings
\defineenigma [othermessage] [secretmessage]

%% here we go!
\starttext

\startothermessage  %% enable machine 1
\startsecretmessage %% enable machine 2 while no 1 is active
Encryption equals decryption.
\stopothermessage
\stopsecretmessage

\stoptext \endinput
\stopcontexttyping

\stopdocsection

\stopdocchapter

\startdocchapter[title=Acknowledgements]
The Enigma module was inspired by Arno Trautmann’s
\identifier{chickenize} package.
Without \LUATEX, encryption on node-level would not have been possible.
\stopdocchapter