-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlite_scramble.rs
513 lines (462 loc) · 23.4 KB
/
lite_scramble.rs
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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
//use std::mem;
use byteorder::{LittleEndian};
use byteorder::ByteOrder;
use utility::*;
const JABER_WACKY: &'static str = r#"Jabberwocky
BY LEWIS CARROLL
’Twas brillig, and the slithy toves
Did gyre and gimble in the wabe:
All mimsy were the borogoves,
And the mome raths outgrabe.
“Beware the Jabberwock, my son!
The jaws that bite, the claws that catch!
Beware the Jubjub bird, and shun
The frumious Bandersnatch!”
He took his vorpal sword in hand;
Long time the manxome foe he sought—
So rested he by the Tumtum tree
And stood awhile in thought.
And, as in uffish thought he stood,
The Jabberwock, with eyes of flame,
Came whiffling through the tulgey wood,
And burbled as it came!
One, two! One, two! And through and through
The vorpal blade went snicker-snack!
He left it dead, and with its head
He went galumphing back.
“And hast thou slain the Jabberwock?
Come to my arms, my beamish boy!
O frabjous day! Callooh! Callay!”
He chortled in his joy.
’Twas brillig, and the slithy toves
Did gyre and gimble in the wabe:
All mimsy were the borogoves,
And the mome raths outgrabe.
2.718281828459045235360287471352662497757247093699959574966
967627724076630353547594571382178525166427427466391932003059
921817413596629043572900334295260595630738132328627943490763
233829880753195251019011573834187930702154089149934884167509
244761460668082264800168477411853742345442437107539077744992
069551702761838606261331384583000752044933826560297606737113
200709328709127443747047230696977209310141692836819025515108
657463772111252389784425056953696770785449969967946864454905
987931636889230098793127736178215424999229576351482208269895
193668033182528869398496465105820939239829488793320362509443
117301238197068416140397019837679320683282376464804295311802
328782509819455815301756717361332069811250996181881593041690
351598888519345807273866738589422879228499892086805825749279
610484198444363463244968487560233624827041978623209002160990
235304369941849146314093431738143640546253152096183690888707
016768396424378140592714563549061303107208510383750510115747
704171898610687396965521267154688957035035402123407849819334
321068170121005627880235193033224745015853904730419957777093
503660416997329725088687696640355570716226844716256079882651
787134195124665201030592123667719432527867539855894489697096
409754591856956380236370162112047742722836489613422516445078
182442352948636372141740238893441247963574370263755294448337
998016125492278509257782562092622648326277933386566481627725
164019105900491644998289315056604725802778631864155195653244
258698294695930801915298721172556347546396447910145904090586
298496791287406870504895858671747985466775757320568128845920
541334053922000113786300945560688166740016984205580403363795
376452030402432256613527836951177883863874439662532249850654
995886234281899707733276171783928034946501434558897071942586
398772754710962953741521115136835062752602326484728703920764
310059584116612054529703023647254929666938115137322753645098
889031360205724817658511806303644281231496550704751025446501
172721155519486685080036853228183152196003735625279449515828
418829478761085263981395599006737648292244375287184624578036
192981971399147564488262603903381441823262515097482798777996
437308997038886778227138360577297882412561190717663946507063
"#;
const RAVEN_PI: [u32; 1024] = [
0x44A4D2DC, 0xEB196A25, 0x6C5B949C, 0x4AB4B864,
0xE5298A63, 0x77E07E1C, 0x4D7E4AB8, 0x4FBCBB93,
0xB59D424B, 0x99F081E6, 0x22BDD3EF, 0x9D5075DA,
0x33104A2B, 0x42EEB242, 0xA7FBF5E1, 0xD5AC7580,
0x0186F622, 0xFBDF5F89, 0xF15D700B, 0x04411B23,
0x946BD3FB, 0x318056D7, 0xC30E295F, 0xDC8BF4E5,
0x28DDFD65, 0x118DA012, 0x8E030EB8, 0x14B1E165,
0x6B225750, 0xF4F86E8B, 0xD989944D, 0xDECCBAD8,
0x0AC81F08, 0x6702A39E, 0x8209E3F6, 0xDEAF24BD,
0x53F13FC7, 0xD91FDF6E, 0xE0C10D85, 0x307AA2D5,
0x019539A8, 0x99128C77, 0x32441188, 0x89CEA669,
0x38AAE988, 0x2BFB6556, 0xF3DE4125, 0x80B3847C,
0xDF0376FF, 0x1181AAA3, 0x3835DD2E, 0x2D92BF47,
0xE01D994A, 0xC8A1668C, 0x06BB9513, 0x0FC31B07,
0xBCB70782, 0xD24D7B60, 0x7643A5DE, 0x9B1B7228,
0xE133CA9D, 0x81A35AEE, 0x08C2F01F, 0x9CE74AB3,
0x170E8D7E, 0xC5DD1D92, 0x8FCA37C2, 0xA28AA165,
0x6ADD2020, 0xF0211400, 0x22F72D9C, 0x8C8A3CCB,
0xE3A5BCF7, 0x5507F5EB, 0x5C2CC97A, 0xE0B8D9F8,
0x37255C8F, 0x865485F8, 0xD6748AAE, 0x649219F2,
0xA99D13CE, 0xD759A0A6, 0x50ECC07D, 0x5BEAD81E,
0x4B958722, 0x7FE5FDFA, 0x8FF78D8B, 0x3C0ACD3E,
0x708DE35C, 0xF214A6A7, 0x9773B8F1, 0x11A48772,
0x982E62B9, 0xA8BD1C40, 0x4E2EA94C, 0x6A52D0BA,
0xCA7B05D5, 0xCC4CF564, 0xCFC3C11B, 0x3AC194D5,
0xFF30198D, 0x0CC85417, 0xDD582BDF, 0x78E2B004,
0x1FA85270, 0xC31B95F9, 0x0F56C882, 0x752166D8,
0xCB389A48, 0xE5A473A8, 0xF261A681, 0xA6E20124,
0xE1A50B37, 0xA2F9C837, 0x42DCDAF8, 0xFCE192D8,
0xA78FB411, 0xBFE1DF0E, 0xB5F41DD6, 0xAAB2E66E,
0x8B6F5492, 0xAB0F22AB, 0xA436F789, 0xFE7C81B7,
0x42712FDD, 0xC35E3300, 0x7E73BBE9, 0xE6018EE4,
0x8E489A3C, 0x6655FF5C, 0x5B6DC28C, 0x4AFA2E76,
0x05D64233, 0x4DE08026, 0x260AB7D6, 0xB60ED3E4,
0x7ED10729, 0x7B8A93D7, 0xD86DE21E, 0xB0B25E2C,
0x805A205A, 0xAAB50CE8, 0x8E6FBC8E, 0xFEA30A9F,
0x31F4A6A9, 0xCFC52C29, 0x31563F77, 0x5F15C26C,
0xD87E9B9B, 0x39A5BB25, 0xE13E17BD, 0x662DDC83,
0x467ECEA5, 0x283947FB, 0x37DF332C, 0x606AC68A,
0x4AC17335, 0xB24CD7E1, 0x8804985F, 0x1B84122D,
0xF80A4B6A, 0xFBA69159, 0xA0DE784C, 0x7481D97A,
0x4FBD8E30, 0xCD6ABB1F, 0x97A5245B, 0x6B43FACC,
0x7396E8A9, 0xAD6F44CE, 0x1F3EBD2D, 0x2BBD9734,
0x7FF3BB9B, 0x4737DD4E, 0xF5A81B5B, 0x48F16F29,
0x1ECCA92B, 0xF1C1C4E0, 0xAA6531DE, 0x2FEABD36,
0x552008C5, 0x1E5B7E09, 0x841A6A06, 0x1D4DE819,
0xB06023E1, 0x973347CD, 0x0FC604E7, 0x2064B9D8,
0x41AEB12A, 0xAD60B7F6, 0x51FE5B3D, 0x113BF0A8,
0xD85E33A6, 0x38463B5A, 0x5774D548, 0xA2E3B573,
0x3D9F0363, 0xC0720219, 0x024843B3, 0x1BB0F5FD,
0x5424AED6, 0xD1B43E14, 0x32034031, 0x13309A53,
0x00A1CF4F, 0x01E80429, 0x065C511B, 0x58329DC9,
0xA8FD2477, 0xFF74557E, 0x59E8C412, 0xDCB0326F,
0xF24452F9, 0xE020311B, 0x4F9E9638, 0x2A778BEA,
0x52E94E6A, 0xF0644006, 0x540A4070, 0x1BDE954F,
0x392660F6, 0x40EB4801, 0xFDC87C54, 0x6C8853D7,
0xEEE49FF0, 0x3413193E, 0x7DCE0BDA, 0x1D16590F,
0xE865F3F6, 0x943A87E0, 0x07128DD4, 0xE12963FC,
0xE7C6B269, 0x6E11A434, 0x55421071, 0xE05EF10E,
0x37B39041, 0xCE83E1B7, 0x6D45828E, 0x88D4D3D7,
0x87CA6E1C, 0xC71D0121, 0xA546A90A, 0x5F5CC3B2,
0xC183F68A, 0x7A451B0B, 0xE234ACFF, 0xF9CCC2F3,
0x92F1CA07, 0x6C5A1B2A, 0xE8466AE4, 0xC4084417,
0x322D7CD6, 0xBB93BEA2, 0x1BAA4E43, 0xE07716AB,
0x8AB520C4, 0x7C8E9B84, 0x2A19EBBF, 0xDD0F304C,
0x948118DF, 0xF0479473, 0x78289019, 0xC5855193,
0x62040CD2, 0x0C3C3E87, 0xC06E02A1, 0x5B1F6C06,
0x6BA87393, 0x3EF276DD, 0xC91FA07D, 0x1C06B00D,
0x7BDABEFE, 0xDCF479DE, 0x86ECD650, 0x29189164,
0x4FD67D97, 0xE480948C, 0x1BD40F24, 0x6A174D9D,
0x045CD024, 0x9A1A24CB, 0x40470D53, 0x4BC68A68,
0xC984EFEC, 0xE3160842, 0xFB562EEE, 0xE778E8A9,
0x04BA6060, 0x0444A79F, 0xABCA0B0E, 0xCABBBDDE,
0xD1B0574B, 0x035EB245, 0x0741017D, 0x3908A468,
0xBD9AA206, 0x5597CD2D, 0xC21F2AC1, 0xECE50B9A,
0xC4E90A2B, 0x6B3F40C1, 0x29B18BB2, 0x5F2E5140,
0xAD077982, 0x97D1DF0A, 0xCCED96A4, 0x731055A6,
0x2C0AB86C, 0x237080A3, 0xA127F98B, 0xA0441BBD,
0xFEEDA65E, 0x837E6121, 0x14A91B41, 0x10BF7F2D,
0x5E85806A, 0x227A2073, 0xCE826493, 0xA222D615,
0x95E4EE78, 0x43778B2D, 0x33053425, 0xEB12A066,
0x089367DA, 0x436EB421, 0xA8474DE4, 0x5835403E,
0x3B24E598, 0x0347E7D3, 0xF264D5A7, 0x7133762E,
0x0D2E2AB0, 0xC4E87FB8, 0x47AB430C, 0xA40A574F,
0x96F31D06, 0x8DAE2C51, 0x30F20C1A, 0xB4D64D88,
0xB8627275, 0x5B7A73DF, 0x4D1C77FE, 0x89FBE5F0,
0xBBE22492, 0x2C1EEDCF, 0x5F7CB291, 0x3AD712A4,
0x18FA1984, 0x50EFB2A1, 0xBA84D787, 0x92D9D244,
0xC48A4C06, 0x06F336EF, 0xECC7B438, 0x7E13087C,
0x2D050000, 0x5DB9E6AC, 0x54EF0CA9, 0x3FA5925B,
0xD174B5C7, 0xE4D83737, 0x61817DB7, 0x5E7D4771,
0x4BB2A757, 0x450BDA7D, 0x8210C1B6, 0x92D9E4B5,
0x70F97267, 0x77A95454, 0xE0496B03, 0x76517ABC,
0xEB1ED93B, 0x693D8109, 0x66AAC635, 0x3F1230DF,
0xAE753867, 0xC292066E, 0x56B04E5B, 0x0553616C,
0x0E28DF9F, 0x9084A98E, 0xA74FA6E4, 0x5D4EE616,
0xF86FC22A, 0xCE5E8F18, 0xE984078B, 0x6EAA685F,
0x98CC421B, 0xA4228281, 0xA0B2FF18, 0x72CC3099,
0x93B932EB, 0xBC7616D8, 0xE6887031, 0x074558ED,
0x1461A7C2, 0x8C6B4E20, 0x5B6B6F0B, 0xAA904BA2,
0x87A59278, 0x3A35ECC5, 0xB79A086F, 0x178280D6,
0x51196DE2, 0x2BCD4BD4, 0x57DCAA03, 0x159C2DEB,
0xD1F8A43F, 0x65FF6E9F, 0x289B520F, 0x318CC017,
0xCAC390F5, 0xCA22B870, 0x5742C582, 0x43A6B5A0,
0x905FF116, 0x7BD294F6, 0x7994259F, 0xA9E9819C,
0x5B429411, 0xA104877F, 0x1E6A2912, 0x5ECB25EA,
0x7A55473E, 0x1A76CD37, 0x19D8CEF5, 0xBAD1C265,
0x43FFBE6F, 0x340E4334, 0x6439A72B, 0xD2D79A19,
0xFECBC110, 0xD35EE7CF, 0x84F08723, 0x7E306041,
0x210589E5, 0xD3C007EC, 0x61CDCCA1, 0x1EC83595,
0x7EA97E55, 0x2C872B5C, 0x03C82B92, 0xE8801402,
0x0417FDEC, 0xCBA5F217, 0x6557F008, 0xC6489FE6,
0x732F9D69, 0x7F887DE4, 0x2EA4FC97, 0xE84B884A,
0x04404804, 0x98CB1FFB, 0xC667FA19, 0x4789E0CC,
0x07F0251F, 0x3B3BB3B6, 0x3A287A5E, 0xC797A774,
0xB047B24C, 0xCFDC9695, 0xC25A6564, 0x3EF36758,
0x6C985CB4, 0x4FE39D93, 0xA66A8342, 0x49CA2003,
0xA330C186, 0x909F8800, 0xAD5D4C26, 0x111A1F0A,
0x3CD4C67A, 0x6A377044, 0x39A858B7, 0x50D32FD5,
0xCAB15B8B, 0xA73F906B, 0x590083CC, 0xF8FAA163,
0x10C4B3CF, 0x5E1EE332, 0x33CC0365, 0x7BB96F66,
0x70250482, 0x2E2D2918, 0xE789453C, 0xD2EBE8F3,
0xB6F7AA7E, 0xBF0717F2, 0x29C32D69, 0x1A39BCFE,
0x7DD9D1ED, 0x9AF1726E, 0xCCA3F94A, 0x71B95F5E,
0x82F9FE79, 0x88AC90D5, 0x98D863B2, 0xF6079E6D,
0xF68C5B56, 0xE083A452, 0xE246AB79, 0x404FD9D2,
0x6CF95BC7, 0x32E5938E, 0x0F6FF4A4, 0x93657111,
0x5B554CC8, 0xDA3EB7AE, 0x1BD9141A, 0x598CE927,
0xCE69F806, 0xA08537FC, 0x10A5DF96, 0x28A754F8,
0x6749DA25, 0x6F3F0B35, 0x48E348F3, 0x30C9F732,
0x87C448DA, 0x56D0ABB4, 0x393DA185, 0xEAB09E4C,
0xADA15DBE, 0x56E06E8C, 0xA9BF0422, 0x29311F54,
0x0757087F, 0xFBE9166B, 0x4DABC3DF, 0xF8EFA217,
0x6ABB943C, 0xFBD7929C, 0xB3848E17, 0xF6E4F65C,
0x0BFE75CB, 0xF51065D8, 0x397A89D9, 0x99413D8A,
0xAB264A23, 0xB568D5CF, 0x93A2694E, 0x0989B9BA,
0x7C986FA0, 0xDFB7F6A5, 0xB60A6594, 0x0516FECF,
0x9155FE4C, 0xD9099BAB, 0x2E1D2A60, 0x7023B7E9,
0xE520E245, 0x7AD5B176, 0xFF5F4821, 0x7662ABA6,
0x4A8ABC59, 0xCC2E700A, 0x9CC39886, 0xBF699E55,
0x6B7EA753, 0x0A24D371, 0xDCFC7AD1, 0x4A68CE68,
0xDC7D2A05, 0x8BC2075A, 0x6FB37803, 0x61A813FB,
0xF0F25275, 0xEF6424C0, 0x1036929C, 0x349CCC0C,
0x3D99180C, 0xB3D48FA4, 0x86620C96, 0x3E54F2D9,
0x53A1F810, 0xAA806EC6, 0x3E2B1B6B, 0xC0DB81C3,
0x99C3CBA5, 0x5B540726, 0xA98F5ED9, 0x51CE63A4,
0xCCA76158, 0x05DD891B, 0x6F803758, 0x4275D3C3,
0xB260BF20, 0xDAB6FA90, 0xC173A0A9, 0x40E7FFF6,
0x6A8C1C26, 0xFD0FF9AC, 0xC80DD7DC, 0x057B02BB,
0x3C0B8A83, 0x070240A9, 0x0E8D6ACF, 0xA493935A,
0xCE589E8E, 0x110BA3EB, 0x6348F296, 0x698F92E2,
0xF13035C0, 0x66489B52, 0x09367768, 0x4B358D96,
0xB522635F, 0xE782E848, 0x7C6D3F58, 0xB066802F,
0xAD67DF1A, 0xC5EB8E90, 0x97C1BF4C, 0x44FFE143,
0x739F33FE, 0xA6613FF8, 0x8AE3DBA6, 0xC14AC8C4,
0x53194D11, 0x3F8FE07C, 0x2E772323, 0x6B55A20C,
0xCFCDBE3A, 0x3043F082, 0xBF2DA00E, 0x53ACF849,
0xAE8D73D6, 0x5E211E42, 0xE7D31B7C, 0x071E8002,
0x53D971EE, 0x9C0C6391, 0x497F98AC, 0xFA19081D,
0xD2DE6E82, 0x50ED6F53, 0x74B917DD, 0xF3E6B66D,
0xF0056B90, 0x13B7CF28, 0x2AACCBB5, 0x0F9071DB,
0xA8D08F10, 0x696C1D9B, 0xC8814EC5, 0x114F435C,
0xB98956BE, 0x4F8ED17C, 0x299BBA78, 0xE1D5A1A6,
0x95C742A0, 0x45F14D67, 0x60A02E3B, 0xD62D6515,
0x09D59074, 0xD0855C73, 0xCEEFC063, 0x413E9E15,
0xC1064270, 0x4C35C405, 0x29859EF0, 0xB5CA0E44,
0xDCFCECDF, 0xA2AA3C61, 0xA6A1A2D3, 0x4CF385EE,
0xA0700334, 0x589792A0, 0xE924CDD3, 0x3ADC8CD7,
0x84EABFEC, 0xE79D1181, 0xCB84A557, 0xE400B75D,
0x680A02F0, 0xC567D7C3, 0x83DD7738, 0x802C0E67,
0xAB86DE3C, 0x51472D2C, 0xA59436CD, 0x2A8078FC,
0x3D7B4DE5, 0x44155C8F, 0xD71587B5, 0x4EA715CE,
0x0CE04EF0, 0xD94D2B67, 0x10DCF9C3, 0x566A2FEE,
0x6B0CFCDA, 0xCC6FC5A1, 0xF262F066, 0x6A998827,
0xF0AE2224, 0x49A668EC, 0xA3BBD797, 0x558C0CDF,
0xD0F3AAA7, 0xB020CCCE, 0xC5C0BD26, 0x3251158D,
0xC8DFC37B, 0x34C47E81, 0xB7C76403, 0x65FE6C03,
0x59E75EA0, 0x250A9FE3, 0xC2DC4ACD, 0x3CD3F6E8,
0x069657BD, 0xB562501A, 0x176C0881, 0xF09444D2,
0xF6D97BEB, 0x1241C447, 0x9378642B, 0x411CBAE5,
0xEE4275DA, 0x356854BE, 0xD970124D, 0x2EEB6E44,
0x7916D768, 0xE1E312FF, 0x26E53A2F, 0x54CA4880,
0xCB952A10, 0x2852B894, 0x57BD926B, 0x6F643101,
0x6B091345, 0x86D06A80, 0x4732A98B, 0x7B0DF8E9,
0xC1EF5984, 0x48DC65D2, 0x542B48E4, 0xC3597963,
0x0E574304, 0xB53A9FB7, 0xBE7ACC62, 0x3B876661,
0x14771F30, 0x80073593, 0x115DF88C, 0xF0A2F4A2,
0x35CFAE26, 0xA7B2421A, 0x6737EC97, 0x2258A745,
0x74CFC718, 0x9D41E582, 0x7947BF47, 0x8C9E4FD5,
0xC7E34502, 0xE336779C, 0x27EC5DC4, 0xFF262D47,
0x61649E08, 0xEEC77EE3, 0xDD6F496B, 0xC1C10BEF,
0xB2927CA2, 0xF3B2F089, 0xE903E5C0, 0xE5C10325,
0x91E1C019, 0xF4072D65, 0x56B9BAEB, 0x6B1D0D23,
0xF8A1EF3C, 0xC41C7225, 0x87B90FC3, 0x19C5076B,
0x07E7823A, 0xDBB533AE, 0xF0B83A56, 0xC0235958,
0xA54B2440, 0x4328E8A9, 0xF80EA595, 0x00D2F287,
0xCC776EAE, 0xB5C37400, 0xAFAE3EA3, 0xF45F5B41,
0x2035EC99, 0xCA278E3B, 0xC4D0CD14, 0xB2C3AAAB,
0x35EF88A8, 0xFDDD0E23, 0x0183FE0C, 0x3378CA1F,
0x4BA03CE6, 0x35212CDE, 0xD7F188CC, 0x03C203A6,
0x17BD4E3E, 0xD7A8D42A, 0x85AE1D9E, 0xC731EF5B,
0x3B18B8DC, 0xCAB236E8, 0xC9714B0E, 0x66BA4CE2,
0x49E77390, 0x6D37BC2F, 0x8EA82B47, 0x18DABFBC,
0x15094756, 0x2ACF0369, 0x06643951, 0xDDA2B3BA,
0xD70FB956, 0xFFF25D92, 0x2CF831D8, 0xAB78396F,
0x143E780B, 0x14133612, 0xB024D429, 0xBC5CCB6D,
0xF8057BB9, 0x2D84CF3F, 0x48931868, 0x1B5AA94A,
0x6C1DF6EE, 0x0FBAD158, 0x2BA25F4A, 0x17B85FFA,
0x5F68D8CD, 0xE86E7FC8, 0xAF571E84, 0xFC1FD40B,
0x02785015, 0xADA04BB3, 0x5BF665CE, 0x039D4BB7,
0x9258D847, 0x76A00071, 0xFB3B1E9F, 0x7012275F,
0x32EFB345, 0xDDE29348, 0x92048E43, 0x135B2CBB,
0xC03ED4E0, 0xCFF55B6C, 0x528F20E5, 0x60FC0A4B,
0xB104B791, 0x36B46707, 0x4A3737AD, 0x94A0BB3E,
0x684286A2, 0xED33939A, 0x98CD62F9, 0x61E9D5C2,
0x5BFB80A9, 0x805440AC, 0x7A6DE223, 0xFB5A8E2C,
0x680FC68E, 0x66CD1130, 0x2A0C038B, 0xAB07C70E,
0xFD8C7D0C, 0x8B9F7999, 0x6A4A021B, 0x86D74263,
0x65098760, 0x9E4C658B, 0x95994148, 0x1DC2676C,
0x64BBA0A2, 0xF7DAA231, 0x8971A376, 0x3B77FA6B,
0x1C3B9987, 0x34CE05C4, 0x6E4D8DB2, 0xAFA048F4,
0x9CFF78D0, 0xF89368F7, 0x87FB72F0, 0x60A6CFD8,
0xB995EED2, 0xE0B1DE97, 0x1BD747F0, 0xE38DA6A7,
0x977AD44B, 0xD6795CE5, 0x0820777D, 0x7AEE9452,
0xDDD83807, 0x757B93C7, 0x14BAAA6F, 0xCCB9E151,
0xCCDFFF34, 0x8A8D3517, 0x7C326B42, 0x86C7FFA2,
0x2EF26FE4, 0xD1270434, 0xFE1BD6EE, 0x9B7A6EB8,
0xB7A17EB4, 0x2C2540F5, 0x9F593413, 0x96E566C5,
0xEFDB81F2, 0x32A1DBBB, 0x537E10D6, 0xB5A27E3B,
0xF7E2DB84, 0x7730839C, 0xD5768529, 0x5BC433CB,
0x6CE68B91, 0xCFC6EFC2, 0xA9613E71, 0xBDD55640,
0x554BB2D8, 0x648523F7, 0x50112493, 0x0A0B5A81,
0x111E1223, 0x35E4018B, 0xD55FAFEA, 0x558E1AF4,
0x66878CBE, 0x8FE09D18, 0xDA85D112, 0x5AF4ACFC,
0xDBACDE9F, 0xA1B48E34, 0x0DF6AF01, 0xBB31EBB0,
0x4F9F3F1D, 0x0193240D, 0x52823CF1, 0x29371800,
0x3478812F, 0x034ECB2B, 0x7BB0FBBC, 0x3A702208,
0x40474B3A, 0xF56F3FAF, 0x77AD2490, 0x3AB1A8CC,
0xAE659DE5, 0x012494B7, 0x5F0CC92A, 0xB264DBAD,
0x68373A64, 0x963EAA0E, 0x3206844C, 0xAA67DE8F,
0x7BFB507B, 0x04083591, 0x6449B3C6, 0x421C045D,
0xE30ED379, 0x332E1239, 0x1C3176A6, 0x446DDE2C,
0x763F70D9, 0x2E7205AE, 0x5A58DD76, 0x890E3D5B,
0x6D070622, 0x97EB58C6, 0xBF85E43C, 0x2F6C13C1,
0x4605AA90, 0xF8067300, 0x8D6FEAA6, 0xB115A3F9,
0xF457F202, 0xCE13B3BA, 0x53AAE197, 0x0101A34E,
0x5C6CC167, 0x83045F82, 0x51B943C8, 0x86403AB1,
0x37CEE344, 0x2E5EE5DD, 0x83391DD2, 0x5E923D7E,
0xA5093633, 0x666F9102, 0x5E916677, 0x0DA0DF8F,
0x07FB3F5D, 0xBE362E74, 0xF610F5CA, 0xBFDE62D5,
0xD27BA2FC, 0xEBF2D4EC, 0x47FED607, 0xE61EB83F,
0xADB6033B, 0xE02F7688, 0x56392DDD, 0xA19A8878,
0xAF43F06C, 0xE41EE00C, 0xEA0EC25E, 0xD71B8462,
0x1F942102, 0xA52D3716, 0xC51CA477, 0xDE72678A,
0x263C449C, 0x35EABC99, 0xB8875F25, 0x8AA65A3F,
0xA7153080, 0x8CB6175B, 0xDA8140C8, 0x66BB33D8
];
//fn inside_inf(src: u32, dest: u32, infrequent_pool: & [u32; 1024] ) -> (u32) {
// let mut sum: u32 = 0;
//
// sum += src.wrapping_shr(24);
// sum += src.wrapping_shl( 8).wrapping_shr(24);
// sum += src.wrapping_shl(16).wrapping_shr(24);
// sum += src.wrapping_shl(24).wrapping_shr(24);
//
// //println!(" sum infrequent:{}",sum);
//
// dest.wrapping_add(infrequent_pool[sum as usize])
//}
fn jbw_zurg(mm0: u32, start_offset: u32, jaber: &[u8]) -> (u32){
let offset = (4 * mm0.count_ones()) + (start_offset * 4);
//println!(" zoff:{}",offset/4);
let r = LittleEndian::read_u32(& jaber[(offset as usize)..((offset + 4) as usize)]);
//println!(" data:{}",LittleEndian::read_u32(& jaber[(offset as usize)..((offset + 4) as usize)]));
//print!("jaber");
//for i in 1180..1225{
// print!(" {}",jaber[i]);
//}
//println!(" ");
r
}
fn do_rotation(mm0: u32, mm1: u32, mm2: u32, mm3: u32) -> (u32,u32,u32,u32){
let tmp = mm3;
let jump = tmp % 8;
let tmp = tmp / 8;
let sw0 = (tmp % 31) + 1;
let tmp = tmp / 31;
let sw1 = (tmp % 31) + 1;
let tmp = tmp / 31;
let sw2 = (tmp % 31) + 1;
match jump {
0 => (mm0.rotate_right(sw0), mm1.rotate_right(sw1), mm2.rotate_right(sw2),mm3),
1 => (mm0.rotate_left(sw0), mm1.rotate_right(sw1), mm2.rotate_right(sw2),mm3),
2 => (mm0.rotate_right(sw0), mm1.rotate_left(sw1), mm2.rotate_right(sw2),mm3),
3 => (mm0.rotate_left(sw0), mm1.rotate_left(sw1), mm2.rotate_right(sw2),mm3),
4 => (mm0.rotate_right(sw0), mm1.rotate_right(sw1), mm2.rotate_left(sw2) ,mm3),
5 => (mm0.rotate_left(sw0), mm1.rotate_right(sw1), mm2.rotate_left(sw2) ,mm3),
6 => (mm0.rotate_right(sw0), mm1.rotate_left(sw1), mm2.rotate_left(sw2) ,mm3),
7 => (mm0.rotate_left(sw0), mm1.rotate_left(sw1), mm2.rotate_left(sw2) ,mm3),
_ => (1,1,1,1)
}
}
fn z_do_rotation(mm0: u32, mm1: u32, mm2: u32, mm3: u32) -> (u32,u32,u32,u32){
let tmp = mm3;
let jump = tmp % 8;
let tmp = tmp / 8;
let sw0 = (tmp % 31) + 1;
let tmp = tmp / 31;
let sw1 = (tmp % 31) + 1;
let tmp = tmp / 31;
let sw2 = (tmp % 31) + 1;
match jump {
7 => (mm0.rotate_right(sw0), mm1.rotate_right(sw1), mm2.rotate_right(sw2),mm3),
6 => (mm0.rotate_left(sw0), mm1.rotate_right(sw1), mm2.rotate_right(sw2),mm3),
5 => (mm0.rotate_right(sw0), mm1.rotate_left(sw1), mm2.rotate_right(sw2),mm3),
4 => (mm0.rotate_left(sw0), mm1.rotate_left(sw1), mm2.rotate_right(sw2),mm3),
3 => (mm0.rotate_right(sw0), mm1.rotate_right(sw1), mm2.rotate_left(sw2) ,mm3),
2 => (mm0.rotate_left(sw0), mm1.rotate_right(sw1), mm2.rotate_left(sw2) ,mm3),
1 => (mm0.rotate_right(sw0), mm1.rotate_left(sw1), mm2.rotate_left(sw2) ,mm3),
0 => (mm0.rotate_left(sw0), mm1.rotate_left(sw1), mm2.rotate_left(sw2) ,mm3),
_ => (1,1,1,1)
}
}
//println!("4 r0:{} {} {} {}",r0,r1,r2,r3);
pub fn lite_scramble_128(buff: &mut [u8; 16]){
let jaber: &[u8] = JABER_WACKY.as_bytes();
let r0 = LittleEndian::read_u32(&mut buff[0..4]);
let r1 = LittleEndian::read_u32(&mut buff[4..8]);
let r2 = LittleEndian::read_u32(&mut buff[8..12]);
let r3 = LittleEndian::read_u32(&mut buff[12..16]);
let (r0,r1,r2,r3) = infreqen_5(r0,r1,r2,r3, & RAVEN_PI); //step0
let (r0,r1,r2,r3) = spin_around4(r0,r1,r2,r3); //step1
let (r1,r2,r3,r0) = infreqen_5(r1,r2,r3,r0, & RAVEN_PI);
let (r0,r1,r2,r3) = spin_around4(r0,r1,r2,r3);
let r0 = r0.wrapping_add(jbw_zurg(r1, 0,jaber)); //step2
let r1 = r1.wrapping_add(jbw_zurg(r2,33,jaber));
let r2 = r2.wrapping_add(jbw_zurg(r3,66,jaber));
let r3 = r3.wrapping_add(jbw_zurg(r0,99,jaber));
let (r0,r1,r2,r3) = do_rotation(r0,r1,r2,r3); //step3
let (r2,r3,r0,r1) = infreqen_5(r2,r3,r0,r1, & RAVEN_PI);
let (r3,r0,r1,r2) = spin_around4(r3,r0,r1,r2);
let r2 = r2.wrapping_add(jbw_zurg(r0,132,jaber)); //step4
let r3 = r3.wrapping_add(jbw_zurg(r1,165,jaber));
let (r2,r3,r0,r1) = do_rotation(r2,r3,r0,r1); //step5
let (r2,r3,r0,r1) = infreqen_5(r2,r3,r0,r1, & RAVEN_PI);
let (r3,r0,r1,r2) = spin_around4(r3,r0,r1,r2);
let r2 = r2.wrapping_add(jbw_zurg(r0,198,jaber)); //step6
let r3 = r3.wrapping_add(jbw_zurg(r1,231,jaber));
let r0 = r0.wrapping_add(jbw_zurg(r2,264,jaber));
let r1 = r1.wrapping_add(jbw_zurg(r3,297,jaber));
let (r3,r0,r1,r2) = do_rotation(r3,r0,r1,r2); //step7
let (r3,r2,r1,r0) = infreqen_5(r3,r2,r1,r0, & RAVEN_PI);
LittleEndian::write_u32(&mut buff[0..4], r0);
LittleEndian::write_u32(&mut buff[4..8], r1);
LittleEndian::write_u32(&mut buff[8..12], r2);
LittleEndian::write_u32(&mut buff[12..16], r3);
}
pub fn z_lite_scramble_128(buff: &mut [u8; 16]){
let jaber: &[u8] = JABER_WACKY.as_bytes();
let r0 = LittleEndian::read_u32(&mut buff[0..4]);
let r1 = LittleEndian::read_u32(&mut buff[4..8]);
let r2 = LittleEndian::read_u32(&mut buff[8..12]);
let r3 = LittleEndian::read_u32(&mut buff[12..16]);
let (r3,r2,r1,r0) = z_infreqen_5(r3,r2,r1,r0, & RAVEN_PI);
let (r3,r0,r1,r2) = z_do_rotation(r3,r0,r1,r2); //step7
let r1 = r1.wrapping_sub(jbw_zurg(r3,297,jaber));
let r0 = r0.wrapping_sub(jbw_zurg(r2,264,jaber));
let r3 = r3.wrapping_sub(jbw_zurg(r1,231,jaber));
let r2 = r2.wrapping_sub(jbw_zurg(r0,198,jaber)); //step6
let (r3,r0,r1,r2) = z_spin_around4(r3,r0,r1,r2);
let (r2,r3,r0,r1) = z_infreqen_5(r2,r3,r0,r1, & RAVEN_PI);
let (r2,r3,r0,r1) = z_do_rotation(r2,r3,r0,r1); //step5
let r2 = r2.wrapping_sub(jbw_zurg(r0,132,jaber)); //step4
let r3 = r3.wrapping_sub(jbw_zurg(r1,165,jaber));
let (r3,r0,r1,r2) = z_spin_around4(r3,r0,r1,r2);
let (r2,r3,r0,r1) = z_infreqen_5(r2,r3,r0,r1, & RAVEN_PI);
let (r0,r1,r2,r3) = z_do_rotation(r0,r1,r2,r3); //step3
let r3 = r3.wrapping_sub(jbw_zurg(r0,99,jaber));
let r2 = r2.wrapping_sub(jbw_zurg(r3,66,jaber));
let r1 = r1.wrapping_sub(jbw_zurg(r2,33,jaber));
let r0 = r0.wrapping_sub(jbw_zurg(r1, 0,jaber)); //step2
let (r0,r1,r2,r3) = z_spin_around4(r0,r1,r2,r3);
let (r1,r2,r3,r0) = z_infreqen_5(r1,r2,r3,r0, & RAVEN_PI);
let (r0,r1,r2,r3) = z_spin_around4(r0,r1,r2,r3); //step1
let (r0,r1,r2,r3) = z_infreqen_5(r0,r1,r2,r3, & RAVEN_PI); //step0
LittleEndian::write_u32(&mut buff[0..4], r0);
LittleEndian::write_u32(&mut buff[4..8], r1);
LittleEndian::write_u32(&mut buff[8..12], r2);
LittleEndian::write_u32(&mut buff[12..16], r3);
}