1fn byte_for <'a>(word: &str) -> Option<(u8, bool)> {
2 match word {
3 "aardvark" => Some((0x00, true)),
4 "absurd" => Some((0x01, true)),
5 "accrue" => Some((0x02, true)),
6 "acme" => Some((0x03, true)),
7 "adrift" => Some((0x04, true)),
8 "adult" => Some((0x05, true)),
9 "afflict" => Some((0x06, true)),
10 "ahead" => Some((0x07, true)),
11 "aimless" => Some((0x08, true)),
12 "algol" => Some((0x09, true)),
13 "allow" => Some((0x0A, true)),
14 "alone" => Some((0x0B, true)),
15 "ammo" => Some((0x0C, true)),
16 "ancient" => Some((0x0D, true)),
17 "apple" => Some((0x0E, true)),
18 "artist" => Some((0x0F, true)),
19 "assume" => Some((0x10, true)),
20 "athens" => Some((0x11, true)),
21 "atlas" => Some((0x12, true)),
22 "aztec" => Some((0x13, true)),
23 "baboon" => Some((0x14, true)),
24 "backfield" => Some((0x15, true)),
25 "backward" => Some((0x16, true)),
26 "banjo" => Some((0x17, true)),
27 "beaming" => Some((0x18, true)),
28 "bedlamp" => Some((0x19, true)),
29 "beehive" => Some((0x1A, true)),
30 "beeswax" => Some((0x1B, true)),
31 "befriend" => Some((0x1C, true)),
32 "belfast" => Some((0x1D, true)),
33 "berserk" => Some((0x1E, true)),
34 "billiard" => Some((0x1F, true)),
35 "bison" => Some((0x20, true)),
36 "blackjack" => Some((0x21, true)),
37 "blockade" => Some((0x22, true)),
38 "blowtorch" => Some((0x23, true)),
39 "bluebird" => Some((0x24, true)),
40 "bombast" => Some((0x25, true)),
41 "bookshelf" => Some((0x26, true)),
42 "brackish" => Some((0x27, true)),
43 "breadline" => Some((0x28, true)),
44 "breakup" => Some((0x29, true)),
45 "brickyard" => Some((0x2A, true)),
46 "briefcase" => Some((0x2B, true)),
47 "burbank" => Some((0x2C, true)),
48 "button" => Some((0x2D, true)),
49 "buzzard" => Some((0x2E, true)),
50 "cement" => Some((0x2F, true)),
51 "chairlift" => Some((0x30, true)),
52 "chatter" => Some((0x31, true)),
53 "checkup" => Some((0x32, true)),
54 "chisel" => Some((0x33, true)),
55 "choking" => Some((0x34, true)),
56 "chopper" => Some((0x35, true)),
57 "christmas" => Some((0x36, true)),
58 "clamshell" => Some((0x37, true)),
59 "classic" => Some((0x38, true)),
60 "classroom" => Some((0x39, true)),
61 "cleanup" => Some((0x3A, true)),
62 "clockwork" => Some((0x3B, true)),
63 "cobra" => Some((0x3C, true)),
64 "commence" => Some((0x3D, true)),
65 "concert" => Some((0x3E, true)),
66 "cowbell" => Some((0x3F, true)),
67 "crackdown" => Some((0x40, true)),
68 "cranky" => Some((0x41, true)),
69 "crowfoot" => Some((0x42, true)),
70 "crucial" => Some((0x43, true)),
71 "crumpled" => Some((0x44, true)),
72 "crusade" => Some((0x45, true)),
73 "cubic" => Some((0x46, true)),
74 "dashboard" => Some((0x47, true)),
75 "deadbolt" => Some((0x48, true)),
76 "deckhand" => Some((0x49, true)),
77 "dogsled" => Some((0x4A, true)),
78 "dragnet" => Some((0x4B, true)),
79 "drainage" => Some((0x4C, true)),
80 "dreadful" => Some((0x4D, true)),
81 "drifter" => Some((0x4E, true)),
82 "dropper" => Some((0x4F, true)),
83 "drumbeat" => Some((0x50, true)),
84 "drunken" => Some((0x51, true)),
85 "dupont" => Some((0x52, true)),
86 "dwelling" => Some((0x53, true)),
87 "eating" => Some((0x54, true)),
88 "edict" => Some((0x55, true)),
89 "egghead" => Some((0x56, true)),
90 "eightball" => Some((0x57, true)),
91 "endorse" => Some((0x58, true)),
92 "endow" => Some((0x59, true)),
93 "enlist" => Some((0x5A, true)),
94 "erase" => Some((0x5B, true)),
95 "escape" => Some((0x5C, true)),
96 "exceed" => Some((0x5D, true)),
97 "eyeglass" => Some((0x5E, true)),
98 "eyetooth" => Some((0x5F, true)),
99 "facial" => Some((0x60, true)),
100 "fallout" => Some((0x61, true)),
101 "flagpole" => Some((0x62, true)),
102 "flatfoot" => Some((0x63, true)),
103 "flytrap" => Some((0x64, true)),
104 "fracture" => Some((0x65, true)),
105 "framework" => Some((0x66, true)),
106 "freedom" => Some((0x67, true)),
107 "frighten" => Some((0x68, true)),
108 "gazelle" => Some((0x69, true)),
109 "geiger" => Some((0x6A, true)),
110 "glitter" => Some((0x6B, true)),
111 "glucose" => Some((0x6C, true)),
112 "goggles" => Some((0x6D, true)),
113 "goldfish" => Some((0x6E, true)),
114 "gremlin" => Some((0x6F, true)),
115 "guidance" => Some((0x70, true)),
116 "hamlet" => Some((0x71, true)),
117 "highchair" => Some((0x72, true)),
118 "hockey" => Some((0x73, true)),
119 "indoors" => Some((0x74, true)),
120 "indulge" => Some((0x75, true)),
121 "inverse" => Some((0x76, true)),
122 "involve" => Some((0x77, true)),
123 "island" => Some((0x78, true)),
124 "jawbone" => Some((0x79, true)),
125 "keyboard" => Some((0x7A, true)),
126 "kickoff" => Some((0x7B, true)),
127 "kiwi" => Some((0x7C, true)),
128 "klaxon" => Some((0x7D, true)),
129 "locale" => Some((0x7E, true)),
130 "lockup" => Some((0x7F, true)),
131 "merit" => Some((0x80, true)),
132 "minnow" => Some((0x81, true)),
133 "miser" => Some((0x82, true)),
134 "mohawk" => Some((0x83, true)),
135 "mural" => Some((0x84, true)),
136 "music" => Some((0x85, true)),
137 "necklace" => Some((0x86, true)),
138 "neptune" => Some((0x87, true)),
139 "newborn" => Some((0x88, true)),
140 "nightbird" => Some((0x89, true)),
141 "oakland" => Some((0x8A, true)),
142 "obtuse" => Some((0x8B, true)),
143 "offload" => Some((0x8C, true)),
144 "optic" => Some((0x8D, true)),
145 "orca" => Some((0x8E, true)),
146 "payday" => Some((0x8F, true)),
147 "peachy" => Some((0x90, true)),
148 "pheasant" => Some((0x91, true)),
149 "physique" => Some((0x92, true)),
150 "playhouse" => Some((0x93, true)),
151 "pluto" => Some((0x94, true)),
152 "preclude" => Some((0x95, true)),
153 "prefer" => Some((0x96, true)),
154 "preshrunk" => Some((0x97, true)),
155 "printer" => Some((0x98, true)),
156 "prowler" => Some((0x99, true)),
157 "pupil" => Some((0x9A, true)),
158 "puppy" => Some((0x9B, true)),
159 "python" => Some((0x9C, true)),
160 "quadrant" => Some((0x9D, true)),
161 "quiver" => Some((0x9E, true)),
162 "quota" => Some((0x9F, true)),
163 "ragtime" => Some((0xA0, true)),
164 "ratchet" => Some((0xA1, true)),
165 "rebirth" => Some((0xA2, true)),
166 "reform" => Some((0xA3, true)),
167 "regain" => Some((0xA4, true)),
168 "reindeer" => Some((0xA5, true)),
169 "rematch" => Some((0xA6, true)),
170 "repay" => Some((0xA7, true)),
171 "retouch" => Some((0xA8, true)),
172 "revenge" => Some((0xA9, true)),
173 "reward" => Some((0xAA, true)),
174 "rhythm" => Some((0xAB, true)),
175 "ribcage" => Some((0xAC, true)),
176 "ringbolt" => Some((0xAD, true)),
177 "robust" => Some((0xAE, true)),
178 "rocker" => Some((0xAF, true)),
179 "ruffled" => Some((0xB0, true)),
180 "sailboat" => Some((0xB1, true)),
181 "sawdust" => Some((0xB2, true)),
182 "scallion" => Some((0xB3, true)),
183 "scenic" => Some((0xB4, true)),
184 "scorecard" => Some((0xB5, true)),
185 "scotland" => Some((0xB6, true)),
186 "seabird" => Some((0xB7, true)),
187 "select" => Some((0xB8, true)),
188 "sentence" => Some((0xB9, true)),
189 "shadow" => Some((0xBA, true)),
190 "shamrock" => Some((0xBB, true)),
191 "showgirl" => Some((0xBC, true)),
192 "skullcap" => Some((0xBD, true)),
193 "skydive" => Some((0xBE, true)),
194 "slingshot" => Some((0xBF, true)),
195 "slowdown" => Some((0xC0, true)),
196 "snapline" => Some((0xC1, true)),
197 "snapshot" => Some((0xC2, true)),
198 "snowcap" => Some((0xC3, true)),
199 "snowslide" => Some((0xC4, true)),
200 "solo" => Some((0xC5, true)),
201 "southward" => Some((0xC6, true)),
202 "soybean" => Some((0xC7, true)),
203 "spaniel" => Some((0xC8, true)),
204 "spearhead" => Some((0xC9, true)),
205 "spellbind" => Some((0xCA, true)),
206 "spheroid" => Some((0xCB, true)),
207 "spigot" => Some((0xCC, true)),
208 "spindle" => Some((0xCD, true)),
209 "spyglass" => Some((0xCE, true)),
210 "stagehand" => Some((0xCF, true)),
211 "stagnate" => Some((0xD0, true)),
212 "stairway" => Some((0xD1, true)),
213 "standard" => Some((0xD2, true)),
214 "stapler" => Some((0xD3, true)),
215 "steamship" => Some((0xD4, true)),
216 "sterling" => Some((0xD5, true)),
217 "stockman" => Some((0xD6, true)),
218 "stopwatch" => Some((0xD7, true)),
219 "stormy" => Some((0xD8, true)),
220 "sugar" => Some((0xD9, true)),
221 "surmount" => Some((0xDA, true)),
222 "suspense" => Some((0xDB, true)),
223 "sweatband" => Some((0xDC, true)),
224 "swelter" => Some((0xDD, true)),
225 "tactics" => Some((0xDE, true)),
226 "talon" => Some((0xDF, true)),
227 "tapeworm" => Some((0xE0, true)),
228 "tempest" => Some((0xE1, true)),
229 "tiger" => Some((0xE2, true)),
230 "tissue" => Some((0xE3, true)),
231 "tonic" => Some((0xE4, true)),
232 "topmost" => Some((0xE5, true)),
233 "tracker" => Some((0xE6, true)),
234 "transit" => Some((0xE7, true)),
235 "trauma" => Some((0xE8, true)),
236 "treadmill" => Some((0xE9, true)),
237 "trojan" => Some((0xEA, true)),
238 "trouble" => Some((0xEB, true)),
239 "tumor" => Some((0xEC, true)),
240 "tunnel" => Some((0xED, true)),
241 "tycoon" => Some((0xEE, true)),
242 "uncut" => Some((0xEF, true)),
243 "unearth" => Some((0xF0, true)),
244 "unwind" => Some((0xF1, true)),
245 "uproot" => Some((0xF2, true)),
246 "upset" => Some((0xF3, true)),
247 "upshot" => Some((0xF4, true)),
248 "vapor" => Some((0xF5, true)),
249 "village" => Some((0xF6, true)),
250 "virus" => Some((0xF7, true)),
251 "vulcan" => Some((0xF8, true)),
252 "waffle" => Some((0xF9, true)),
253 "wallet" => Some((0xFA, true)),
254 "watchword" => Some((0xFB, true)),
255 "wayside" => Some((0xFC, true)),
256 "willow" => Some((0xFD, true)),
257 "woodlark" => Some((0xFE, true)),
258 "zulu" => Some((0xFF, true)),
259 "adroitness" => Some((0x00, false)),
260 "adviser" => Some((0x01, false)),
261 "aftermath" => Some((0x02, false)),
262 "aggregate" => Some((0x03, false)),
263 "alkali" => Some((0x04, false)),
264 "almighty" => Some((0x05, false)),
265 "amulet" => Some((0x06, false)),
266 "amusement" => Some((0x07, false)),
267 "antenna" => Some((0x08, false)),
268 "applicant" => Some((0x09, false)),
269 "apollo" => Some((0x0A, false)),
270 "armistice" => Some((0x0B, false)),
271 "article" => Some((0x0C, false)),
272 "asteroid" => Some((0x0D, false)),
273 "atlantic" => Some((0x0E, false)),
274 "atmosphere" => Some((0x0F, false)),
275 "autopsy" => Some((0x10, false)),
276 "babylon" => Some((0x11, false)),
277 "backwater" => Some((0x12, false)),
278 "barbecue" => Some((0x13, false)),
279 "belowground" => Some((0x14, false)),
280 "bifocals" => Some((0x15, false)),
281 "bodyguard" => Some((0x16, false)),
282 "bookseller" => Some((0x17, false)),
283 "borderline" => Some((0x18, false)),
284 "bottomless" => Some((0x19, false)),
285 "bradbury" => Some((0x1A, false)),
286 "bravado" => Some((0x1B, false)),
287 "brazilian" => Some((0x1C, false)),
288 "breakaway" => Some((0x1D, false)),
289 "burlington" => Some((0x1E, false)),
290 "businessman" => Some((0x1F, false)),
291 "butterfat" => Some((0x20, false)),
292 "camelot" => Some((0x21, false)),
293 "candidate" => Some((0x22, false)),
294 "cannonball" => Some((0x23, false)),
295 "capricorn" => Some((0x24, false)),
296 "caravan" => Some((0x25, false)),
297 "caretaker" => Some((0x26, false)),
298 "celebrate" => Some((0x27, false)),
299 "cellulose" => Some((0x28, false)),
300 "certify" => Some((0x29, false)),
301 "chambermaid" => Some((0x2A, false)),
302 "cherokee" => Some((0x2B, false)),
303 "chicago" => Some((0x2C, false)),
304 "clergyman" => Some((0x2D, false)),
305 "coherence" => Some((0x2E, false)),
306 "combustion" => Some((0x2F, false)),
307 "commando" => Some((0x30, false)),
308 "company" => Some((0x31, false)),
309 "component" => Some((0x32, false)),
310 "concurrent" => Some((0x33, false)),
311 "confidence" => Some((0x34, false)),
312 "conformist" => Some((0x35, false)),
313 "congregate" => Some((0x36, false)),
314 "consensus" => Some((0x37, false)),
315 "consulting" => Some((0x38, false)),
316 "corporate" => Some((0x39, false)),
317 "corrosion" => Some((0x3A, false)),
318 "councilman" => Some((0x3B, false)),
319 "crossover" => Some((0x3C, false)),
320 "crucifix" => Some((0x3D, false)),
321 "cumbersome" => Some((0x3E, false)),
322 "customer" => Some((0x3F, false)),
323 "dakota" => Some((0x40, false)),
324 "decadence" => Some((0x41, false)),
325 "december" => Some((0x42, false)),
326 "decimal" => Some((0x43, false)),
327 "designing" => Some((0x44, false)),
328 "detector" => Some((0x45, false)),
329 "detergent" => Some((0x46, false)),
330 "determine" => Some((0x47, false)),
331 "dictator" => Some((0x48, false)),
332 "dinosaur" => Some((0x49, false)),
333 "direction" => Some((0x4A, false)),
334 "disable" => Some((0x4B, false)),
335 "disbelief" => Some((0x4C, false)),
336 "disruptive" => Some((0x4D, false)),
337 "distortion" => Some((0x4E, false)),
338 "document" => Some((0x4F, false)),
339 "embezzle" => Some((0x50, false)),
340 "enchanting" => Some((0x51, false)),
341 "enrollment" => Some((0x52, false)),
342 "enterprise" => Some((0x53, false)),
343 "equation" => Some((0x54, false)),
344 "equipment" => Some((0x55, false)),
345 "escapade" => Some((0x56, false)),
346 "eskimo" => Some((0x57, false)),
347 "everyday" => Some((0x58, false)),
348 "examine" => Some((0x59, false)),
349 "existence" => Some((0x5A, false)),
350 "exodus" => Some((0x5B, false)),
351 "fascinate" => Some((0x5C, false)),
352 "filament" => Some((0x5D, false)),
353 "finicky" => Some((0x5E, false)),
354 "forever" => Some((0x5F, false)),
355 "fortitude" => Some((0x60, false)),
356 "frequency" => Some((0x61, false)),
357 "gadgetry" => Some((0x62, false)),
358 "galveston" => Some((0x63, false)),
359 "getaway" => Some((0x64, false)),
360 "glossary" => Some((0x65, false)),
361 "gossamer" => Some((0x66, false)),
362 "graduate" => Some((0x67, false)),
363 "gravity" => Some((0x68, false)),
364 "guitarist" => Some((0x69, false)),
365 "hamburger" => Some((0x6A, false)),
366 "hamilton" => Some((0x6B, false)),
367 "handiwork" => Some((0x6C, false)),
368 "hazardous" => Some((0x6D, false)),
369 "headwaters" => Some((0x6E, false)),
370 "hemisphere" => Some((0x6F, false)),
371 "hesitate" => Some((0x70, false)),
372 "hideaway" => Some((0x71, false)),
373 "holiness" => Some((0x72, false)),
374 "hurricane" => Some((0x73, false)),
375 "hydraulic" => Some((0x74, false)),
376 "impartial" => Some((0x75, false)),
377 "impetus" => Some((0x76, false)),
378 "inception" => Some((0x77, false)),
379 "indigo" => Some((0x78, false)),
380 "inertia" => Some((0x79, false)),
381 "infancy" => Some((0x7A, false)),
382 "inferno" => Some((0x7B, false)),
383 "informant" => Some((0x7C, false)),
384 "insincere" => Some((0x7D, false)),
385 "insurgent" => Some((0x7E, false)),
386 "integrate" => Some((0x7F, false)),
387 "intention" => Some((0x80, false)),
388 "inventive" => Some((0x81, false)),
389 "istanbul" => Some((0x82, false)),
390 "jamaica" => Some((0x83, false)),
391 "jupiter" => Some((0x84, false)),
392 "leprosy" => Some((0x85, false)),
393 "letterhead" => Some((0x86, false)),
394 "liberty" => Some((0x87, false)),
395 "maritime" => Some((0x88, false)),
396 "matchmaker" => Some((0x89, false)),
397 "maverick" => Some((0x8A, false)),
398 "medusa" => Some((0x8B, false)),
399 "megaton" => Some((0x8C, false)),
400 "microscope" => Some((0x8D, false)),
401 "microwave" => Some((0x8E, false)),
402 "midsummer" => Some((0x8F, false)),
403 "millionaire" => Some((0x90, false)),
404 "miracle" => Some((0x91, false)),
405 "misnomer" => Some((0x92, false)),
406 "molasses" => Some((0x93, false)),
407 "molecule" => Some((0x94, false)),
408 "montana" => Some((0x95, false)),
409 "monument" => Some((0x96, false)),
410 "mosquito" => Some((0x97, false)),
411 "narrative" => Some((0x98, false)),
412 "nebula" => Some((0x99, false)),
413 "newsletter" => Some((0x9A, false)),
414 "norwegian" => Some((0x9B, false)),
415 "october" => Some((0x9C, false)),
416 "ohio" => Some((0x9D, false)),
417 "onlooker" => Some((0x9E, false)),
418 "opulent" => Some((0x9F, false)),
419 "orlando" => Some((0xA0, false)),
420 "outfielder" => Some((0xA1, false)),
421 "pacific" => Some((0xA2, false)),
422 "pandemic" => Some((0xA3, false)),
423 "pandora" => Some((0xA4, false)),
424 "paperweight" => Some((0xA5, false)),
425 "paragon" => Some((0xA6, false)),
426 "paragraph" => Some((0xA7, false)),
427 "paramount" => Some((0xA8, false)),
428 "passenger" => Some((0xA9, false)),
429 "pedigree" => Some((0xAA, false)),
430 "pegasus" => Some((0xAB, false)),
431 "penetrate" => Some((0xAC, false)),
432 "perceptive" => Some((0xAD, false)),
433 "performance" => Some((0xAE, false)),
434 "pharmacy" => Some((0xAF, false)),
435 "phonetic" => Some((0xB0, false)),
436 "photograph" => Some((0xB1, false)),
437 "pioneer" => Some((0xB2, false)),
438 "pocketful" => Some((0xB3, false)),
439 "politeness" => Some((0xB4, false)),
440 "positive" => Some((0xB5, false)),
441 "potato" => Some((0xB6, false)),
442 "processor" => Some((0xB7, false)),
443 "provincial" => Some((0xB8, false)),
444 "proximate" => Some((0xB9, false)),
445 "puberty" => Some((0xBA, false)),
446 "publisher" => Some((0xBB, false)),
447 "pyramid" => Some((0xBC, false)),
448 "quantity" => Some((0xBD, false)),
449 "racketeer" => Some((0xBE, false)),
450 "rebellion" => Some((0xBF, false)),
451 "recipe" => Some((0xC0, false)),
452 "recover" => Some((0xC1, false)),
453 "repellent" => Some((0xC2, false)),
454 "replica" => Some((0xC3, false)),
455 "reproduce" => Some((0xC4, false)),
456 "resistor" => Some((0xC5, false)),
457 "responsive" => Some((0xC6, false)),
458 "retraction" => Some((0xC7, false)),
459 "retrieval" => Some((0xC8, false)),
460 "retrospect" => Some((0xC9, false)),
461 "revenue" => Some((0xCA, false)),
462 "revival" => Some((0xCB, false)),
463 "revolver" => Some((0xCC, false)),
464 "sandalwood" => Some((0xCD, false)),
465 "sardonic" => Some((0xCE, false)),
466 "saturday" => Some((0xCF, false)),
467 "savagery" => Some((0xD0, false)),
468 "scavenger" => Some((0xD1, false)),
469 "sensation" => Some((0xD2, false)),
470 "sociable" => Some((0xD3, false)),
471 "souvenir" => Some((0xD4, false)),
472 "specialist" => Some((0xD5, false)),
473 "speculate" => Some((0xD6, false)),
474 "stethoscope" => Some((0xD7, false)),
475 "stupendous" => Some((0xD8, false)),
476 "supportive" => Some((0xD9, false)),
477 "surrender" => Some((0xDA, false)),
478 "suspicious" => Some((0xDB, false)),
479 "sympathy" => Some((0xDC, false)),
480 "tambourine" => Some((0xDD, false)),
481 "telephone" => Some((0xDE, false)),
482 "therapist" => Some((0xDF, false)),
483 "tobacco" => Some((0xE0, false)),
484 "tolerance" => Some((0xE1, false)),
485 "tomorrow" => Some((0xE2, false)),
486 "torpedo" => Some((0xE3, false)),
487 "tradition" => Some((0xE4, false)),
488 "travesty" => Some((0xE5, false)),
489 "trombonist" => Some((0xE6, false)),
490 "truncated" => Some((0xE7, false)),
491 "typewriter" => Some((0xE8, false)),
492 "ultimate" => Some((0xE9, false)),
493 "undaunted" => Some((0xEA, false)),
494 "underfoot" => Some((0xEB, false)),
495 "unicorn" => Some((0xEC, false)),
496 "unify" => Some((0xED, false)),
497 "universe" => Some((0xEE, false)),
498 "unravel" => Some((0xEF, false)),
499 "upcoming" => Some((0xF0, false)),
500 "vacancy" => Some((0xF1, false)),
501 "vagabond" => Some((0xF2, false)),
502 "vertigo" => Some((0xF3, false)),
503 "virginia" => Some((0xF4, false)),
504 "visitor" => Some((0xF5, false)),
505 "vocalist" => Some((0xF6, false)),
506 "voyager" => Some((0xF7, false)),
507 "warranty" => Some((0xF8, false)),
508 "waterloo" => Some((0xF9, false)),
509 "whimsical" => Some((0xFA, false)),
510 "wichita" => Some((0xFB, false)),
511 "wilmington" => Some((0xFC, false)),
512 "wyoming" => Some((0xFD, false)),
513 "yesteryear" => Some((0xFE, false)),
514 "yucatan" => Some((0xFF, false)),
515 _ => None
516 }
517}
518
519fn word_for <'a>(byte: u8, is_even: bool) -> &'a str {
520 if is_even {
521 match byte {
522 0x00 => "aardvark",
523 0x01 => "absurd",
524 0x02 => "accrue",
525 0x03 => "acme",
526 0x04 => "adrift",
527 0x05 => "adult",
528 0x06 => "afflict",
529 0x07 => "ahead",
530 0x08 => "aimless",
531 0x09 => "algol",
532 0x0A => "allow",
533 0x0B => "alone",
534 0x0C => "ammo",
535 0x0D => "ancient",
536 0x0E => "apple",
537 0x0F => "artist",
538 0x10 => "assume",
539 0x11 => "athens",
540 0x12 => "atlas",
541 0x13 => "aztec",
542 0x14 => "baboon",
543 0x15 => "backfield",
544 0x16 => "backward",
545 0x17 => "banjo",
546 0x18 => "beaming",
547 0x19 => "bedlamp",
548 0x1A => "beehive",
549 0x1B => "beeswax",
550 0x1C => "befriend",
551 0x1D => "belfast",
552 0x1E => "berserk",
553 0x1F => "billiard",
554 0x20 => "bison",
555 0x21 => "blackjack",
556 0x22 => "blockade",
557 0x23 => "blowtorch",
558 0x24 => "bluebird",
559 0x25 => "bombast",
560 0x26 => "bookshelf",
561 0x27 => "brackish",
562 0x28 => "breadline",
563 0x29 => "breakup",
564 0x2A => "brickyard",
565 0x2B => "briefcase",
566 0x2C => "burbank",
567 0x2D => "button",
568 0x2E => "buzzard",
569 0x2F => "cement",
570 0x30 => "chairlift",
571 0x31 => "chatter",
572 0x32 => "checkup",
573 0x33 => "chisel",
574 0x34 => "choking",
575 0x35 => "chopper",
576 0x36 => "christmas",
577 0x37 => "clamshell",
578 0x38 => "classic",
579 0x39 => "classroom",
580 0x3A => "cleanup",
581 0x3B => "clockwork",
582 0x3C => "cobra",
583 0x3D => "commence",
584 0x3E => "concert",
585 0x3F => "cowbell",
586 0x40 => "crackdown",
587 0x41 => "cranky",
588 0x42 => "crowfoot",
589 0x43 => "crucial",
590 0x44 => "crumpled",
591 0x45 => "crusade",
592 0x46 => "cubic",
593 0x47 => "dashboard",
594 0x48 => "deadbolt",
595 0x49 => "deckhand",
596 0x4A => "dogsled",
597 0x4B => "dragnet",
598 0x4C => "drainage",
599 0x4D => "dreadful",
600 0x4E => "drifter",
601 0x4F => "dropper",
602 0x50 => "drumbeat",
603 0x51 => "drunken",
604 0x52 => "dupont",
605 0x53 => "dwelling",
606 0x54 => "eating",
607 0x55 => "edict",
608 0x56 => "egghead",
609 0x57 => "eightball",
610 0x58 => "endorse",
611 0x59 => "endow",
612 0x5A => "enlist",
613 0x5B => "erase",
614 0x5C => "escape",
615 0x5D => "exceed",
616 0x5E => "eyeglass",
617 0x5F => "eyetooth",
618 0x60 => "facial",
619 0x61 => "fallout",
620 0x62 => "flagpole",
621 0x63 => "flatfoot",
622 0x64 => "flytrap",
623 0x65 => "fracture",
624 0x66 => "framework",
625 0x67 => "freedom",
626 0x68 => "frighten",
627 0x69 => "gazelle",
628 0x6A => "geiger",
629 0x6B => "glitter",
630 0x6C => "glucose",
631 0x6D => "goggles",
632 0x6E => "goldfish",
633 0x6F => "gremlin",
634 0x70 => "guidance",
635 0x71 => "hamlet",
636 0x72 => "highchair",
637 0x73 => "hockey",
638 0x74 => "indoors",
639 0x75 => "indulge",
640 0x76 => "inverse",
641 0x77 => "involve",
642 0x78 => "island",
643 0x79 => "jawbone",
644 0x7A => "keyboard",
645 0x7B => "kickoff",
646 0x7C => "kiwi",
647 0x7D => "klaxon",
648 0x7E => "locale",
649 0x7F => "lockup",
650 0x80 => "merit",
651 0x81 => "minnow",
652 0x82 => "miser",
653 0x83 => "mohawk",
654 0x84 => "mural",
655 0x85 => "music",
656 0x86 => "necklace",
657 0x87 => "neptune",
658 0x88 => "newborn",
659 0x89 => "nightbird",
660 0x8A => "oakland",
661 0x8B => "obtuse",
662 0x8C => "offload",
663 0x8D => "optic",
664 0x8E => "orca",
665 0x8F => "payday",
666 0x90 => "peachy",
667 0x91 => "pheasant",
668 0x92 => "physique",
669 0x93 => "playhouse",
670 0x94 => "pluto",
671 0x95 => "preclude",
672 0x96 => "prefer",
673 0x97 => "preshrunk",
674 0x98 => "printer",
675 0x99 => "prowler",
676 0x9A => "pupil",
677 0x9B => "puppy",
678 0x9C => "python",
679 0x9D => "quadrant",
680 0x9E => "quiver",
681 0x9F => "quota",
682 0xA0 => "ragtime",
683 0xA1 => "ratchet",
684 0xA2 => "rebirth",
685 0xA3 => "reform",
686 0xA4 => "regain",
687 0xA5 => "reindeer",
688 0xA6 => "rematch",
689 0xA7 => "repay",
690 0xA8 => "retouch",
691 0xA9 => "revenge",
692 0xAA => "reward",
693 0xAB => "rhythm",
694 0xAC => "ribcage",
695 0xAD => "ringbolt",
696 0xAE => "robust",
697 0xAF => "rocker",
698 0xB0 => "ruffled",
699 0xB1 => "sailboat",
700 0xB2 => "sawdust",
701 0xB3 => "scallion",
702 0xB4 => "scenic",
703 0xB5 => "scorecard",
704 0xB6 => "scotland",
705 0xB7 => "seabird",
706 0xB8 => "select",
707 0xB9 => "sentence",
708 0xBA => "shadow",
709 0xBB => "shamrock",
710 0xBC => "showgirl",
711 0xBD => "skullcap",
712 0xBE => "skydive",
713 0xBF => "slingshot",
714 0xC0 => "slowdown",
715 0xC1 => "snapline",
716 0xC2 => "snapshot",
717 0xC3 => "snowcap",
718 0xC4 => "snowslide",
719 0xC5 => "solo",
720 0xC6 => "southward",
721 0xC7 => "soybean",
722 0xC8 => "spaniel",
723 0xC9 => "spearhead",
724 0xCA => "spellbind",
725 0xCB => "spheroid",
726 0xCC => "spigot",
727 0xCD => "spindle",
728 0xCE => "spyglass",
729 0xCF => "stagehand",
730 0xD0 => "stagnate",
731 0xD1 => "stairway",
732 0xD2 => "standard",
733 0xD3 => "stapler",
734 0xD4 => "steamship",
735 0xD5 => "sterling",
736 0xD6 => "stockman",
737 0xD7 => "stopwatch",
738 0xD8 => "stormy",
739 0xD9 => "sugar",
740 0xDA => "surmount",
741 0xDB => "suspense",
742 0xDC => "sweatband",
743 0xDD => "swelter",
744 0xDE => "tactics",
745 0xDF => "talon",
746 0xE0 => "tapeworm",
747 0xE1 => "tempest",
748 0xE2 => "tiger",
749 0xE3 => "tissue",
750 0xE4 => "tonic",
751 0xE5 => "topmost",
752 0xE6 => "tracker",
753 0xE7 => "transit",
754 0xE8 => "trauma",
755 0xE9 => "treadmill",
756 0xEA => "trojan",
757 0xEB => "trouble",
758 0xEC => "tumor",
759 0xED => "tunnel",
760 0xEE => "tycoon",
761 0xEF => "uncut",
762 0xF0 => "unearth",
763 0xF1 => "unwind",
764 0xF2 => "uproot",
765 0xF3 => "upset",
766 0xF4 => "upshot",
767 0xF5 => "vapor",
768 0xF6 => "village",
769 0xF7 => "virus",
770 0xF8 => "vulcan",
771 0xF9 => "waffle",
772 0xFA => "wallet",
773 0xFB => "watchword",
774 0xFC => "wayside",
775 0xFD => "willow",
776 0xFE => "woodlark",
777 0xFF => "zulu",
778 _ => "DEADF00D"
779 }
780 } else {
781 match byte {
782 0x00 => "adroitness",
783 0x01 => "adviser",
784 0x02 => "aftermath",
785 0x03 => "aggregate",
786 0x04 => "alkali",
787 0x05 => "almighty",
788 0x06 => "amulet",
789 0x07 => "amusement",
790 0x08 => "antenna",
791 0x09 => "applicant",
792 0x0A => "apollo",
793 0x0B => "armistice",
794 0x0C => "article",
795 0x0D => "asteroid",
796 0x0E => "atlantic",
797 0x0F => "atmosphere",
798 0x10 => "autopsy",
799 0x11 => "babylon",
800 0x12 => "backwater",
801 0x13 => "barbecue",
802 0x14 => "belowground",
803 0x15 => "bifocals",
804 0x16 => "bodyguard",
805 0x17 => "bookseller",
806 0x18 => "borderline",
807 0x19 => "bottomless",
808 0x1A => "bradbury",
809 0x1B => "bravado",
810 0x1C => "brazilian",
811 0x1D => "breakaway",
812 0x1E => "burlington",
813 0x1F => "businessman",
814 0x20 => "butterfat",
815 0x21 => "camelot",
816 0x22 => "candidate",
817 0x23 => "cannonball",
818 0x24 => "capricorn",
819 0x25 => "caravan",
820 0x26 => "caretaker",
821 0x27 => "celebrate",
822 0x28 => "cellulose",
823 0x29 => "certify",
824 0x2A => "chambermaid",
825 0x2B => "cherokee",
826 0x2C => "chicago",
827 0x2D => "clergyman",
828 0x2E => "coherence",
829 0x2F => "combustion",
830 0x30 => "commando",
831 0x31 => "company",
832 0x32 => "component",
833 0x33 => "concurrent",
834 0x34 => "confidence",
835 0x35 => "conformist",
836 0x36 => "congregate",
837 0x37 => "consensus",
838 0x38 => "consulting",
839 0x39 => "corporate",
840 0x3A => "corrosion",
841 0x3B => "councilman",
842 0x3C => "crossover",
843 0x3D => "crucifix",
844 0x3E => "cumbersome",
845 0x3F => "customer",
846 0x40 => "dakota",
847 0x41 => "decadence",
848 0x42 => "december",
849 0x43 => "decimal",
850 0x44 => "designing",
851 0x45 => "detector",
852 0x46 => "detergent",
853 0x47 => "determine",
854 0x48 => "dictator",
855 0x49 => "dinosaur",
856 0x4A => "direction",
857 0x4B => "disable",
858 0x4C => "disbelief",
859 0x4D => "disruptive",
860 0x4E => "distortion",
861 0x4F => "document",
862 0x50 => "embezzle",
863 0x51 => "enchanting",
864 0x52 => "enrollment",
865 0x53 => "enterprise",
866 0x54 => "equation",
867 0x55 => "equipment",
868 0x56 => "escapade",
869 0x57 => "eskimo",
870 0x58 => "everyday",
871 0x59 => "examine",
872 0x5A => "existence",
873 0x5B => "exodus",
874 0x5C => "fascinate",
875 0x5D => "filament",
876 0x5E => "finicky",
877 0x5F => "forever",
878 0x60 => "fortitude",
879 0x61 => "frequency",
880 0x62 => "gadgetry",
881 0x63 => "galveston",
882 0x64 => "getaway",
883 0x65 => "glossary",
884 0x66 => "gossamer",
885 0x67 => "graduate",
886 0x68 => "gravity",
887 0x69 => "guitarist",
888 0x6A => "hamburger",
889 0x6B => "hamilton",
890 0x6C => "handiwork",
891 0x6D => "hazardous",
892 0x6E => "headwaters",
893 0x6F => "hemisphere",
894 0x70 => "hesitate",
895 0x71 => "hideaway",
896 0x72 => "holiness",
897 0x73 => "hurricane",
898 0x74 => "hydraulic",
899 0x75 => "impartial",
900 0x76 => "impetus",
901 0x77 => "inception",
902 0x78 => "indigo",
903 0x79 => "inertia",
904 0x7A => "infancy",
905 0x7B => "inferno",
906 0x7C => "informant",
907 0x7D => "insincere",
908 0x7E => "insurgent",
909 0x7F => "integrate",
910 0x80 => "intention",
911 0x81 => "inventive",
912 0x82 => "istanbul",
913 0x83 => "jamaica",
914 0x84 => "jupiter",
915 0x85 => "leprosy",
916 0x86 => "letterhead",
917 0x87 => "liberty",
918 0x88 => "maritime",
919 0x89 => "matchmaker",
920 0x8A => "maverick",
921 0x8B => "medusa",
922 0x8C => "megaton",
923 0x8D => "microscope",
924 0x8E => "microwave",
925 0x8F => "midsummer",
926 0x90 => "millionaire",
927 0x91 => "miracle",
928 0x92 => "misnomer",
929 0x93 => "molasses",
930 0x94 => "molecule",
931 0x95 => "montana",
932 0x96 => "monument",
933 0x97 => "mosquito",
934 0x98 => "narrative",
935 0x99 => "nebula",
936 0x9A => "newsletter",
937 0x9B => "norwegian",
938 0x9C => "october",
939 0x9D => "ohio",
940 0x9E => "onlooker",
941 0x9F => "opulent",
942 0xA0 => "orlando",
943 0xA1 => "outfielder",
944 0xA2 => "pacific",
945 0xA3 => "pandemic",
946 0xA4 => "pandora",
947 0xA5 => "paperweight",
948 0xA6 => "paragon",
949 0xA7 => "paragraph",
950 0xA8 => "paramount",
951 0xA9 => "passenger",
952 0xAA => "pedigree",
953 0xAB => "pegasus",
954 0xAC => "penetrate",
955 0xAD => "perceptive",
956 0xAE => "performance",
957 0xAF => "pharmacy",
958 0xB0 => "phonetic",
959 0xB1 => "photograph",
960 0xB2 => "pioneer",
961 0xB3 => "pocketful",
962 0xB4 => "politeness",
963 0xB5 => "positive",
964 0xB6 => "potato",
965 0xB7 => "processor",
966 0xB8 => "provincial",
967 0xB9 => "proximate",
968 0xBA => "puberty",
969 0xBB => "publisher",
970 0xBC => "pyramid",
971 0xBD => "quantity",
972 0xBE => "racketeer",
973 0xBF => "rebellion",
974 0xC0 => "recipe",
975 0xC1 => "recover",
976 0xC2 => "repellent",
977 0xC3 => "replica",
978 0xC4 => "reproduce",
979 0xC5 => "resistor",
980 0xC6 => "responsive",
981 0xC7 => "retraction",
982 0xC8 => "retrieval",
983 0xC9 => "retrospect",
984 0xCA => "revenue",
985 0xCB => "revival",
986 0xCC => "revolver",
987 0xCD => "sandalwood",
988 0xCE => "sardonic",
989 0xCF => "saturday",
990 0xD0 => "savagery",
991 0xD1 => "scavenger",
992 0xD2 => "sensation",
993 0xD3 => "sociable",
994 0xD4 => "souvenir",
995 0xD5 => "specialist",
996 0xD6 => "speculate",
997 0xD7 => "stethoscope",
998 0xD8 => "stupendous",
999 0xD9 => "supportive",
1000 0xDA => "surrender",
1001 0xDB => "suspicious",
1002 0xDC => "sympathy",
1003 0xDD => "tambourine",
1004 0xDE => "telephone",
1005 0xDF => "therapist",
1006 0xE0 => "tobacco",
1007 0xE1 => "tolerance",
1008 0xE2 => "tomorrow",
1009 0xE3 => "torpedo",
1010 0xE4 => "tradition",
1011 0xE5 => "travesty",
1012 0xE6 => "trombonist",
1013 0xE7 => "truncated",
1014 0xE8 => "typewriter",
1015 0xE9 => "ultimate",
1016 0xEA => "undaunted",
1017 0xEB => "underfoot",
1018 0xEC => "unicorn",
1019 0xED => "unify",
1020 0xEE => "universe",
1021 0xEF => "unravel",
1022 0xF0 => "upcoming",
1023 0xF1 => "vacancy",
1024 0xF2 => "vagabond",
1025 0xF3 => "vertigo",
1026 0xF4 => "virginia",
1027 0xF5 => "visitor",
1028 0xF6 => "vocalist",
1029 0xF7 => "voyager",
1030 0xF8 => "warranty",
1031 0xF9 => "waterloo",
1032 0xFA => "whimsical",
1033 0xFB => "wichita",
1034 0xFC => "wilmington",
1035 0xFD => "wyoming",
1036 0xFE => "yesteryear",
1037 0xFF => "yucatan",
1038 _ => "DEADF00D"
1039 }
1040 }
1041}
1042
1043pub fn to_bytes<S: AsRef<str>>(words: &[S]) -> Option<Vec<u8>> {
1044 let mut bytes = Vec::with_capacity(words.len());
1045 let mut is_even = true;
1046 for word in words {
1047 let byte_opt = byte_for(word.as_ref());
1048 match byte_opt {
1049 Some((byte, evenness)) => {
1050 if evenness != is_even {
1051 return None
1052 }
1053 bytes.push(byte);
1054 is_even = !is_even;
1055 },
1056 None => return None
1057 }
1058 }
1059 Some(bytes)
1060}
1061
1062pub fn to_words(bytes: &[u8]) -> Vec<&str> {
1063 let mut is_even = true;
1064 let mut words = Vec::with_capacity(bytes.len());
1065
1066 for byte in bytes {
1067 words.push(word_for(*byte, is_even));
1068 is_even = !is_even;
1069 }
1070
1071 words
1072}
1073
1074
1075#[cfg(test)]
1076mod tests {
1077 #[test]
1078 fn to_words_test() {
1079 let msg: [u8; 4] = [0x2D, 0x6D, 0xED, 0x27];
1080 let words = super::to_words(&msg);
1081 assert_eq!(words[0], "button");
1082 assert_eq!(words[1], "hazardous");
1083 assert_eq!(words[2], "tunnel");
1084 assert_eq!(words[3], "celebrate");
1085 }
1086
1087 #[test]
1088 fn no_deadfood_test() {
1089 for byte in 0..255 {
1090 assert!(super::word_for(byte, true) != "DEADF00D");
1091 assert!(super::word_for(byte, false) != "DEADF00D");
1092 }
1093 }
1094
1095 #[test]
1096 fn to_bytes_test() {
1097 let mut words = Vec::new();
1098 words.push("topmost");
1099 words.push("istanbul");
1100 words.push("pluto");
1101 words.push("vagabond");
1102 let bytes = super::to_bytes(&words);
1103
1104 assert!(bytes.is_some());
1105 let bytes = bytes.unwrap();
1106 assert_eq!(bytes[0], 0xE5);
1107 assert_eq!(bytes[1], 0x82);
1108 assert_eq!(bytes[2], 0x94);
1109 assert_eq!(bytes[3], 0xF2);
1110 }
1111
1112 #[test]
1113 fn roundtrip_test() {
1114 let msg: [u8; 20] = [
1115 0xE5, 0x82, 0x94, 0xF2,
1116 0xE9, 0xA2, 0x27, 0x48,
1117 0x6E, 0x8B, 0x06, 0x1B,
1118 0x31, 0xCC, 0x52, 0x8F,
1119 0xD7, 0xFA, 0x3F, 0x19
1120 ];
1121
1122 let words = super::to_words(&msg);
1123 assert_eq!(words, [
1124 "topmost", "istanbul", "pluto", "vagabond",
1125 "treadmill", "pacific", "brackish", "dictator",
1126 "goldfish", "medusa", "afflict", "bravado",
1127 "chatter", "revolver", "dupont", "midsummer",
1128 "stopwatch", "whimsical", "cowbell", "bottomless"
1129 ]);
1130 let bytes = super::to_bytes(&words);
1131
1132 assert!(bytes.is_some());
1133 let bytes = bytes.unwrap();
1134 assert_eq!(bytes, msg);
1135 }
1136}