[ create a new paste ] login | about

Link: http://codepad.org/Dc6LY5cV    [ raw code | output | fork ]

C, pasted on Feb 19:
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
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
#include <stdio.h>
#include <emmintrin.h>
#include <time.h>
//有限体の要素
unsigned char GF[256]={0,1,2,4,8,16,32,64,128,29,58,116,232,205,135,19,38,76,152,45,90,180,117,234,201,143,3,6,12,24,48,96,192,157,39,78,156,37,74,148,53,106,212,181,119,238,193,159,35,70,140,5,10,20,40,80,160,93,186,105,210,185,111,222,161,95,190,97,194,153,47,94,188,101,202,137,15,30,60,120,240,253,231,211,187,107,214,177,127,254,225,223,163,91,182,113,226,217,175,67,134,17,34,68,136,13,26,52,104,208,189,103,206,129,31,62,124,248,237,199,147,59,118,236,197,151,51,102,204,133,23,46,92,184,109,218,169,79,158,33,66,132,21,42,84,168,77,154,41,82,164,85,170,73,146,57,114,228,213,183,115,230,209,191,99,198,145,63,126,252,229,215,179,123,246,241,255,227,219,171,75,150,49,98,196,149,55,110,220,165,87,174,65,130,25,50,100,200,141,7,14,28,56,112,224,221,167,83,166,81,162,89,178,121,242,249,239,195,155,43,86,172,69,138,9,18,36,72,144,61,122,244,245,247,243,251,235,203,139,11,22,44,88,176,125,250,233,207,131,27,54,108,216,173,71,142};
//有限体のインデックス
unsigned char FG[256]={0,1,2,26,3,51,27,199,4,224,52,239,28,105,200,76,5,101,225,15,53,142,240,130,29,194,106,249,201,9,77,114,6,139,102,48,226,37,16,34,54,148,143,219,241,19,131,70,30,182,195,126,107,40,250,186,202,155,10,121,78,229,115,167,7,192,140,99,103,222,49,254,227,153,38,180,17,146,35,137,55,209,149,207,144,151,220,190,242,211,20,93,132,57,71,65,31,67,183,164,196,73,127,111,108,59,41,85,251,134,187,62,203,95,156,160,11,22,122,44,79,213,230,173,116,244,168,88,8,113,193,248,141,129,100,14,104,75,223,238,50,198,255,25,228,166,154,120,39,185,181,125,18,69,147,218,36,33,138,47,56,64,210,92,150,189,208,206,145,136,152,179,221,253,191,98,243,87,212,172,21,43,94,159,133,61,58,84,72,110,66,163,32,46,68,217,184,124,165,119,197,24,74,237,128,13,112,247,109,162,60,83,42,158,86,171,252,97,135,178,188,205,63,91,204,90,96,177,157,170,161,82,12,246,23,236,123,118,45,216,80,175,214,234,231,232,174,233,117,215,245,235,169,81,89,176};


//暗号化行列1
unsigned char h1[256][16]={
  {64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
  {171,171,171,171,171,171,171,171,171,171,171,171,171,171,171,171},
  {156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171},
  {140,165,190,215,240,10,35,60,85,110,135,160,185,210,235,5},
  {35,37,39,41,43,45,47,49,51,53,55,57,59,61,63,65},
  {213,8,58,108,158,208,3,53,103,153,203,253,48,98,148,198},
{192,218,244,15,41,67,93,119,145,171,197,223,249,20,46,72},
{28,226,169,112,55,253,196,139,82,25,223,166,109,52,250,193},
{200,203,206,209,212,215,218,221,224,227,230,233,236,239,242,245},
{21,244,212,180,148,116,84,52,20,243,211,179,147,115,83,51},
{155,206,2,53,104,155,206,2,53,104,155,206,2,53,104,155},
{6,244,227,210,193,176,159,142,125,108,91,74,57,40,23,6},
{111,138,165,192,219,246,18,45,72,99,126,153,180,207,234,6},
{147,251,100,204,53,157,6,110,214,63,167,16,120,224,73,177},
{240,184,128,72,16,215,159,103,47,246,190,134,78,22,221,165},
{9,84,159,234,54,129,204,24,99,174,249,69,144,219,39,114},
{237,241,245,249,253,2,6,10,14,18,22,26,30,34,38,42},
{20,120,220,65,165,10,110,210,55,155,255,100,200,45,145,245},
{51,20,244,213,182,151,120,89,58,27,251,220,189,158,127,96},
{206,220,234,248,7,21,35,49,63,77,91,105,119,133,147,161},
{125,177,229,26,78,130,182,234,31,83,135,187,239,36,88,140},
{247,133,19,160,46,187,73,214,100,241,127,13,154,40,181,67},
{90,74,58,42,26,10,249,233,217,201,185,169,153,137,121,105},
{236,110,239,113,242,116,245,119,248,122,251,125,254,128,2,131},
{130,158,186,214,242,15,43,71,99,127,155,183,211,239,12,40},
{45,238,176,114,52,245,183,121,59,252,190,128,66,4,197,135},
{220,70,175,25,130,235,85,190,40,145,250,100,205,55,160,10},
{172,165,158,151,144,137,130,123,116,109,102,95,88,81,74,67},
{207,152,97,42,242,187,132,77,22,222,167,112,57,2,202,147},
{187,195,203,211,219,227,235,243,251,4,12,20,28,36,44,52},
{97,173,249,70,146,222,43,119,195,16,92,168,244,65,141,217},
{191,49,162,20,133,246,104,217,75,188,46,159,17,130,243,101},
{131,136,141,146,151,156,161,166,171,176,181,186,191,196,201,206},
{173,56,194,77,215,98,236,119,2,140,23,161,44,182,65,203},
{235,81,182,28,129,230,76,177,23,124,225,71,172,18,119,220},
{152,199,246,38,85,132,179,226,18,65,112,159,206,253,45,92},
{230,200,170,140,110,80,50,20,245,215,185,155,125,95,65,35},
{174,210,246,27,63,99,135,171,207,243,24,60,96,132,168,204},
{25,40,55,70,85,100,115,130,145,160,175,190,205,220,235,250},
{1,34,67,100,133,166,199,232,10,43,76,109,142,175,208,241},
{183,236,34,87,140,193,246,44,97,150,203,1,54,107,160,213},
{102,249,141,33,180,72,219,111,3,150,42,189,81,228,120,12},
{126,13,155,42,184,71,213,100,242,129,16,158,45,187,74,216},
{197,160,123,86,49,12,230,193,156,119,82,45,8,226,189,152},
{37,22,7,247,232,217,202,187,172,157,142,127,112,97,82,67},
{188,206,224,242,5,23,41,59,77,95,113,131,149,167,185,203},
{246,121,251,126,1,131,6,136,11,141,16,146,21,151,26,156},
{120,189,3,72,141,210,24,93,162,231,45,114,183,252,66,135},
{53,82,111,140,169,198,227,1,30,59,88,117,146,175,204,233},
{208,134,60,241,167,93,19,200,126,52,233,159,85,11,192,118},
{82,21,215,154,93,32,226,165,104,43,237,176,115,54,248,187},
{42,167,37,162,32,157,27,152,22,147,17,142,12,137,7,132},
{157,8,114,220,71,177,28,134,240,91,197,48,154,5,111,217},
{26,65,104,143,182,221,5,44,83,122,161,200,239,23,62,101},
{78,72,66,60,54,48,42,36,30,24,18,12,6,255,249,243},
{72,2,187,117,47,232,162,92,22,207,137,67,252,182,112,42},
{123,69,15,216,162,108,54,255,201,147,93,39,240,186,132,78},
{249,148,47,201,100,254,153,52,206,105,4,158,57,211,110,9},
{197,206,215,224,233,242,251,5,14,23,32,41,50,59,68,77},
{64,184,49,169,34,154,19,139,4,124,244,109,229,94,214,79},
{161,238,60,137,214,36,113,190,12,89,166,243,65,142,219,41},
{151,124,97,70,43,16,244,217,190,163,136,109,82,55,28,1},
{138,252,111,225,84,198,57,171,30,144,3,117,231,90,204,63},
{219,130,41,207,118,29,195,106,17,183,94,5,171,82,248,159},
{121,127,133,139,145,151,157,163,169,175,181,187,193,199,205,211},
{34,225,161,97,33,224,160,96,32,223,159,95,31,222,158,94},
{250,134,18,157,41,180,64,203,87,226,110,249,133,17,156,40},
{232,75,173,16,114,212,55,153,251,94,192,35,133,231,74,172},
{144,246,93,195,42,144,246,93,195,42,144,246,93,195,42,144},
{103,69,35,1,222,188,154,120,86,52,18,239,205,171,137,103},
{167,215,8,56,104,152,200,248,41,89,137,185,233,26,74,122},
{177,175,173,171,169,167,165,163,161,159,157,155,153,151,149,147},
{246,217,188,159,130,101,72,43,14,240,211,182,153,124,95,66},
{75,227,124,21,173,70,222,119,16,168,65,217,114,11,163,60},
{152,189,226,8,45,82,119,156,193,230,12,49,86,123,160,197},
{151,75,254,178,102,26,205,129,53,232,156,80,4,183,107,31},
{60,76,92,108,124,140,156,172,188,204,220,236,252,13,29,45},
{177,67,212,102,247,137,27,172,62,207,97,242,132,22,167,57},
{218,252,31,65,99,133,167,201,235,14,48,82,116,150,184,218},
{247,128,9,145,26,162,43,179,60,196,77,213,94,230,111,247},
{36,90,144,198,252,51,105,159,213,12,66,120,174,228,27,81},
{62,15,223,176,129,82,35,243,196,149,102,55,8,216,169,122},
{113,6,154,47,195,88,236,129,22,170,63,211,104,252,145,38},
{242,193,144,95,46,252,203,154,105,56,7,213,164,115,66,17},
{52,195,83,226,114,2,145,33,176,64,207,95,238,126,14,157},
{231,126,21,171,66,216,111,6,156,51,201,96,246,141,36,186},
{194,158,122,86,50,14,233,197,161,125,89,53,17,236,200,164},
{254,188,122,56,245,179,113,47,236,170,104,38,227,161,95,29},
{135,121,107,93,79,65,51,37,23,9,250,236,222,208,194,180},
{143,98,53,8,218,173,128,83,38,248,203,158,113,68,23,233},
{143,162,181,200,219,238,2,21,40,59,78,97,116,135,154,173},
{176,13,105,197,34,126,218,55,147,239,76,168,5,97,189,26},
{122,253,129,5,136,12,143,19,150,26,157,33,164,40,171,47},
{180,236,37,93,149,205,6,62,118,174,230,31,87,143,199,255},
{75,145,215,30,100,170,240,55,125,195,10,80,150,220,35,105},
{182,246,55,119,183,247,56,120,184,248,57,121,185,249,58,122},
{233,8,38,68,98,128,158,188,218,248,23,53,83,113,143,173},
{229,40,106,172,238,49,115,181,247,58,124,190,1,67,133,199},
{43,225,152,79,6,188,115,42,224,151,78,5,187,114,41,223},
{127,35,198,106,14,177,85,248,156,64,227,135,43,206,114,22},
{153,93,33,228,168,108,48,243,183,123,63,3,198,138,78,18},
{37,109,181,253,70,142,214,31,103,175,247,64,136,208,25,97},
{40,166,37,163,34,160,31,157,28,154,25,151,22,148,19,145},
{41,151,6,116,226,81,191,46,156,11,121,231,86,196,51,161},
{66,173,25,132,239,91,198,50,157,9,116,223,75,182,34,141},
{183,241,44,102,160,218,21,79,137,195,253,56,114,172,230,33},
{179,219,4,44,84,124,164,204,244,29,69,109,149,189,229,14},
{141,225,54,138,222,51,135,219,48,132,216,45,129,213,42,126},
{240,235,230,225,220,215,210,205,200,195,190,185,180,175,170,165},
{90,223,101,234,112,245,123,1,134,12,145,23,156,34,167,45},
{157,88,19,205,136,67,253,184,115,46,232,163,94,25,211,142},
{109,170,231,37,98,159,220,26,87,148,209,15,76,137,198,4},
{194,141,88,35,237,184,131,78,25,227,174,121,68,15,217,164},
{54,148,242,81,175,14,108,202,41,135,229,68,162,1,95,189},
{232,132,32,187,87,242,142,42,197,97,252,152,52,207,107,7},
{100,4,163,67,226,130,34,193,97,1,160,64,223,127,31,190},
{64,74,84,94,104,114,124,134,144,154,164,174,184,194,204,214},
{192,213,234,255,21,42,63,84,105,126,147,168,189,210,231,252},
{120,241,107,228,94,215,81,202,68,189,55,176,42,163,29,150},
{163,206,249,37,80,123,166,209,252,40,83,126,169,212,255,43},
{25,103,181,4,82,160,238,61,139,217,40,118,196,19,97,175},
{88,45,2,214,171,128,85,42,254,211,168,125,82,39,251,208},
{108,82,56,30,4,233,207,181,155,129,103,77,51,25,254,228},
{135,52,224,141,58,230,147,64,236,153,70,242,159,76,248,165},
{55,170,30,145,5,120,235,95,210,70,185,45,160,20,135,250},
{212,200,188,176,164,152,140,128,116,104,92,80,68,56,44,32},
{168,80,247,159,71,238,150,62,229,141,53,220,132,44,211,123},
{145,232,64,151,238,70,157,244,76,163,250,82,169,1,88,175},
{66,73,80,87,94,101,108,115,122,129,136,143,150,157,164,171},
{28,140,252,109,221,78,190,47,159,16,128,240,97,209,66,178},
{173,110,47,239,176,113,50,242,179,116,53,245,182,119,56,248},
{129,121,113,105,97,89,81,73,65,57,49,41,33,25,17,9},
{92,232,117,2,142,27,167,52,192,77,217,102,242,127,12,152},
{185,58,186,59,187,60,188,61,189,62,190,63,191,64,192,65},
{227,71,170,14,113,212,56,155,254,98,197,41,140,239,83,182},
{68,81,94,107,120,133,146,159,172,185,198,211,224,237,250,8},
{57,160,8,111,214,62,165,13,116,219,67,170,18,121,224,72},
{112,186,5,79,153,227,46,120,194,13,87,161,235,54,128,202},
{98,65,32,254,221,188,155,122,89,56,23,245,212,179,146,113},
{176,158,140,122,104,86,68,50,32,14,251,233,215,197,179,161},
{241,35,84,133,182,231,25,74,123,172,221,15,64,113,162,211},
{18,215,157,99,41,238,180,122,64,6,203,145,87,29,226,168},
{167,166,165,164,163,162,161,160,159,158,157,156,155,154,153,152},
{1,25,49,73,97,121,145,169,193,217,241,10,34,58,82,106},
{98,70,42,14,241,213,185,157,129,101,73,45,17,244,216,188},
{172,82,247,157,67,232,142,52,217,127,37,202,112,22,187,97},
{124,22,175,73,226,124,22,175,73,226,124,22,175,73,226,124},
{181,45,164,28,147,11,130,249,113,232,96,215,79,198,62,181},
{185,223,6,44,82,120,158,196,234,17,55,93,131,169,207,245},
{142,71,255,184,113,42,226,155,84,13,197,126,55,239,168,97},
{162,87,12,192,117,42,222,147,72,252,177,102,27,207,132,57},
{201,70,194,63,187,56,180,49,173,42,166,35,159,28,152,21},
{104,121,138,155,172,189,206,223,240,2,19,36,53,70,87,104},
{176,244,57,125,193,6,74,142,210,23,91,159,227,40,108,176},
{234,125,16,162,53,199,90,236,127,18,164,55,201,92,238,129},
{95,57,19,236,198,160,122,84,46,8,225,187,149,111,73,35},
{48,83,118,153,188,223,3,38,73,108,143,178,213,248,28,63},
{44,76,108,140,172,204,236,13,45,77,109,141,173,205,237,14},
{178,60,197,79,216,98,235,117,254,136,18,155,37,174,56,193},
{244,35,81,127,173,219,10,56,102,148,194,240,31,77,123,169},
{176,231,31,86,141,196,251,51,106,161,216,16,71,126,181,236},
{105,168,231,39,102,165,228,36,99,162,225,33,96,159,222,30},
{57,11,220,174,128,82,36,245,199,153,107,61,15,224,178,132},
{255,91,182,18,109,200,36,127,218,54,145,236,72,163,254,90},
{228,122,16,165,59,208,102,251,145,39,188,82,231,125,19,168},
{163,96,29,217,150,83,16,204,137,70,3,191,124,57,245,178},
{213,165,117,69,21,228,180,132,84,36,243,195,147,99,51,3},
{214,164,114,64,14,219,169,119,69,19,224,174,124,74,24,229},
{123,12,156,45,189,78,222,111,255,144,33,177,66,210,99,243},
{26,161,41,176,56,191,71,206,86,221,101,236,116,251,131,11},
{162,58,209,105,1,152,48,199,95,246,142,38,189,85,236,132},
{1,179,102,25,203,126,49,227,150,73,251,174,97,20,198,121},
{233,198,163,128,93,58,23,243,208,173,138,103,68,33,253,218},
{34,31,28,25,22,19,16,13,10,7,4,1,253,250,247,244},
{202,137,72,7,197,132,67,2,192,127,62,252,187,122,57,247},
{175,17,114,211,53,150,247,89,186,28,125,222,64,161,3,100},
{154,141,128,115,102,89,76,63,50,37,24,11,253,240,227,214},
{3,89,175,6,92,178,9,95,181,12,98,184,15,101,187,18},
{66,22,233,189,145,101,57,13,224,180,136,92,48,4,215,171},
{121,37,208,124,40,211,127,43,214,130,46,217,133,49,220,136},
{115,135,155,175,195,215,235,255,20,40,60,80,100,120,140,160},
{250,37,79,121,163,205,247,34,76,118,160,202,244,31,73,115},
{69,162,255,93,186,24,117,210,48,141,234,72,165,3,96,189},
{182,85,243,146,49,207,110,13,171,74,232,135,38,196,99,2},
{183,60,192,69,201,78,210,87,219,96,228,105,237,114,246,123},
{244,49,109,169,229,34,94,154,214,19,79,139,199,4,64,124},
{91,148,205,7,64,121,178,235,37,94,151,208,10,67,124,181},
{129,212,40,123,206,34,117,200,28,111,194,22,105,188,16,99},
{43,114,185,1,72,143,214,30,101,172,243,59,130,201,17,88},
{251,105,214,68,177,31,140,249,103,212,66,175,29,138,247,101},
{208,18,83,148,213,23,88,153,218,28,93,158,223,33,98,163},
{53,215,122,29,191,98,5,167,74,236,143,50,212,119,26,188},
{225,1,32,63,94,125,156,187,218,249,25,56,87,118,149,180},
{22,67,112,157,202,247,37,82,127,172,217,7,52,97,142,187},
{52,119,186,253,65,132,199,11,78,145,212,24,91,158,225,37},
{96,57,18,234,195,156,117,78,39,255,216,177,138,99,60,21},
{3,186,114,42,225,153,81,9,192,120,48,231,159,87,15,198},
{9,132,255,123,246,114,237,105,228,96,219,87,210,78,201,69},
{235,144,53,217,126,35,199,108,17,181,90,254,163,72,236,145},
{196,59,177,40,158,21,139,2,120,238,101,219,82,200,63,181},
{16,212,153,94,35,231,172,113,54,250,191,132,73,14,210,151},
{56,79,102,125,148,171,194,217,240,8,31,54,77,100,123,146},
{173,246,64,137,210,28,101,174,247,65,138,211,29,102,175,248},
{178,159,140,121,102,83,64,45,26,7,243,224,205,186,167,148},
{182,54,181,53,180,52,179,51,178,50,177,49,176,48,175,47},
{104,116,128,140,152,164,176,188,200,212,224,236,248,5,17,29},
{24,135,246,102,213,69,180,36,147,3,114,225,81,192,48,159},
{96,87,78,69,60,51,42,33,24,15,6,252,243,234,225,216},
{237,90,198,51,159,12,120,228,81,189,42,150,3,111,219,72},
{28,189,95,1,162,68,229,135,41,202,108,14,175,81,242,148},
{26,85,144,203,7,66,125,184,243,47,106,165,224,28,87,146},
{51,133,215,42,124,206,33,115,197,24,106,188,15,97,179,6},
{120,161,202,243,29,70,111,152,193,234,20,61,102,143,184,225},
{144,46,203,105,7,164,66,223,125,27,184,86,243,145,47,204},
{34,119,204,34,119,204,34,119,204,34,119,204,34,119,204,34},
{77,247,162,77,247,162,77,247,162,77,247,162,77,247,162,77},
{101,97,93,89,85,81,77,73,69,65,61,57,53,49,45,41},
{235,76,172,13,109,205,46,142,238,79,175,16,112,208,49,145},
{206,85,219,98,232,111,245,124,3,137,16,150,29,163,42,176},
{109,31,208,130,52,229,151,73,250,172,94,16,193,115,37,214},
{61,248,180,112,44,231,163,95,27,214,146,78,10,197,129,61},
{184,133,82,31,235,184,133,82,31,235,184,133,82,31,235,184},
{172,234,41,103,165,227,34,96,158,220,27,89,151,213,20,82},
{202,37,127,217,52,142,232,67,157,247,82,172,7,97,187,22},
{43,246,194,142,90,38,241,189,137,85,33,236,184,132,80,28},
{26,115,204,38,127,216,50,139,228,62,151,240,74,163,252,86},
{97,192,32,127,222,62,157,252,92,187,27,122,217,57,152,247},
{77,253,174,95,16,192,113,34,210,131,52,228,149,70,246,167},
{237,138,39,195,96,252,153,54,210,111,12,168,69,225,126,27},
{165,79,248,162,76,245,159,73,242,156,70,239,153,67,236,150},
{222,127,32,192,97,2,162,67,227,132,37,197,102,7,167,72},
{147,228,54,135,216,42,123,204,30,111,192,18,99,180,6,87},
{165,176,187,198,209,220,231,242,253,9,20,31,42,53,64,75},
{18,8,253,243,233,223,213,203,193,183,173,163,153,143,133,123},
{221,243,10,32,54,76,98,120,142,164,186,208,230,252,19,41},
{158,138,118,98,78,58,38,18,253,233,213,193,173,153,133,113},
{190,57,179,46,168,35,157,24,146,13,135,2,124,246,113,235},
{178,40,157,19,136,253,115,232,94,211,73,190,52,169,31,148},
{182,226,15,59,103,147,191,235,24,68,112,156,200,244,33,77},
{42,2,217,177,137,97,57,17,232,192,152,112,72,32,247,207},
{193,17,96,175,254,78,157,236,60,139,218,42,121,200,24,103},
{52,226,145,64,238,157,76,250,169,88,7,181,100,19,193,112},
{197,155,113,71,29,242,200,158,116,74,32,245,203,161,119,77},
{246,224,202,180,158,136,114,92,70,48,26,4,237,215,193,171},
{110,85,60,35,10,240,215,190,165,140,115,90,65,40,15,245},
{67,43,19,250,226,202,178,154,130,106,82,58,34,10,241,217},
{49,222,140,58,231,149,67,240,158,76,249,167,85,3,176,94},
{163,140,117,94,71,48,25,2,234,211,188,165,142,119,96,73},
{112,228,89,205,66,182,43,159,20,136,252,113,229,90,206,67},
{157,116,75,34,248,207,166,125,84,43,2,216,175,134,93,52},
{149,138,127,116,105,94,83,72,61,50,39,28,17,6,250,239},
{102,81,60,39,18,252,231,210,189,168,147,126,105,84,63,42},
{165,78,246,159,72,240,153,66,234,147,60,228,141,54,222,135},
{197,22,102,182,7,87,167,247,72,152,232,57,137,217,42,122},
{173,6,94,182,15,103,191,24,112,200,33,121,209,42,130,218},
{239,159,79,254,174,94,14,189,109,29,204,124,44,219,139,59}
};

//暗号化行列2
unsigned char h2[256][16]={
  {0,0,0,0,0,0,0,0,0,64,0,0,0,64,64,0},
  {171,171,171,171,171,171,171,171,171,0,0,0,0,171,0,0},
  {172,173,174,175,176,177,178,179,180,157,158,159,160,39,254,255},
  {30,55,80,105,130,155,180,205,230,128,153,178,203,60,148,173},
  {67,69,71,73,75,77,79,81,83,37,39,41,43,56,231,233},
  {248,43,93,143,193,243,38,88,138,189,239,34,84,53,229,24},
  {98,124,150,176,202,228,254,25,51,65,91,117,143,110,12,38},
  {136,79,22,220,163,106,49,247,190,21,219,162,105,70,46,244},
  {248,251,254,2,5,8,11,14,17,144,147,150,153,116,24,27},
  {19,242,210,178,146,114,82,50,18,18,241,209,177,201,227,195},
  {206,2,53,104,155,206,2,53,104,0,0,0,0,155,138,189},
  {244,227,210,193,176,159,142,125,108,176,159,142,125,227,193,176},
{33,60,87,114,141,168,195,222,249,83,110,137,164,24,183,210},
{26,130,234,83,187,36,140,244,93,149,253,102,206,74,192,41},
{109,53,252,196,140,84,28,227,171,54,253,197,141,244,74,18},
{189,9,84,159,234,54,129,204,24,71,146,221,41,67,4,79},
{46,50,54,58,62,66,70,74,78,241,245,249,253,24,119,123},
{90,190,35,135,235,80,180,25,125,227,72,172,17,210,52,152},
{65,34,3,227,196,165,134,103,72,62,31,255,224,14,255,224},
{175,189,203,217,231,245,4,18,32,127,141,155,169,124,155,169},
{192,244,41,93,145,197,249,46,98,126,178,230,27,216,20,72},
{208,94,235,121,7,148,34,175,61,233,119,5,146,76,28,169},
{89,73,57,41,25,9,248,232,216,216,200,184,168,180,193,177},
{5,134,8,137,11,140,14,143,17,208,82,211,85,194,148,22},
{68,96,124,152,180,208,236,9,37,227,255,28,56,221,28,56},
{73,11,204,142,80,18,211,149,87,67,5,198,136,226,198,136},
{115,220,70,175,25,130,235,85,190,164,14,119,224,36,60,165},
{60,53,46,39,32,25,18,11,4,85,78,71,64,45,215,208},
{92,37,237,182,127,72,17,217,162,111,56,1,201,77,16,216},
{60,68,76,84,92,100,108,116,124,195,203,211,219,16,206,214},
{38,114,190,11,87,163,239,60,136,85,161,237,58,21,0,0},
{214,72,185,43,156,14,127,240,98,233,91,204,62,65,22,135},
{211,216,221,226,231,236,241,246,251,70,75,80,85,247,174,179},
{86,224,107,245,128,11,149,32,170,62,200,83,221,234,248,131},
{66,167,13,114,215,61,162,8,109,211,57,158,4,174,64,165},
{139,186,233,25,72,119,166,213,5,56,103,150,197,171,182,229},
{5,230,200,170,140,110,80,50,20,8,233,203,173,55,232,202},
{240,21,57,93,129,165,201,237,18,63,99,135,171,189,157,193},
{10,25,40,55,70,85,100,115,130,34,49,64,79,155,41,56},
{19,52,85,118,151,184,217,250,28,133,166,199,232,121,120,153},
{11,64,117,170,223,21,74,127,180,185,238,36,89,44,84,137},
{159,51,198,90,237,129,21,168,60,95,242,134,26,211,127,19},
{103,245,132,19,161,48,190,77,219,148,35,177,64,39,189,76},
{115,78,41,4,222,185,148,111,74,118,81,44,7,135,111,74},
{52,37,22,7,247,232,217,202,187,181,166,151,136,77,38,23},
{221,239,2,20,38,56,74,92,110,5,23,41,59,68,52,70},
{31,161,36,166,41,171,46,176,51,88,218,93,223,49,140,15},
{204,18,87,156,225,39,108,177,246,192,6,75,144,23,30,99},
{7,36,65,94,123,152,181,210,239,97,126,155,184,134,179,208},
{44,225,151,77,3,184,110,36,217,50,231,157,83,84,36,217},
{126,65,4,198,137,76,15,209,148,220,159,98,37,15,94,33},
{2,127,252,122,247,117,242,112,237,204,74,199,69,13,38,163},
{68,174,25,131,237,88,194,45,151,161,12,118,224,134,214,65},
{140,179,218,2,41,80,119,158,197,12,51,90,129,244,76,115},
{237,231,225,219,213,207,201,195,189,71,65,59,53,92,23,17},
{227,157,87,17,202,132,62,247,177,104,34,219,149,184,92,22},
{24,225,171,117,63,9,210,156,102,247,193,139,85,50,8,209},
{163,62,216,115,14,168,67,221,120,250,149,48,202,52,72,226},
{86,95,104,113,122,131,140,149,158,233,242,251,5,137,129,138},
{199,64,184,49,169,34,154,19,139,136,1,121,241,84,192,57},
{118,195,17,94,171,248,70,147,224,34,111,188,10,190,200,22},
{229,202,175,148,121,94,67,40,13,213,186,159,132,242,221,194},
{177,36,150,9,123,237,96,210,69,169,28,142,1,56,173,32},
{70,236,147,58,224,135,46,212,123,28,194,105,16,106,111,22},
{217,223,229,235,241,247,253,4,10,9,15,21,27,208,24,30},
{30,221,157,93,29,220,156,92,28,28,219,155,91,139,191,127},
{179,63,202,86,225,109,248,132,16,76,215,99,238,7,173,57},
{15,113,211,54,152,250,93,191,34,136,234,77,175,134,0,0},
{246,93,195,42,144,246,93,195,42,0,0,0,0,144,110,212},
{69,35,1,222,188,154,120,86,52,188,154,120,86,35,222,188},
{170,218,11,59,107,155,203,251,44,36,84,132,180,98,156,204},
{145,143,141,139,137,135,133,131,129,129,127,125,123,252,158,156},
{37,8,234,205,176,147,118,89,60,75,46,17,243,249,163,134},
{212,109,6,158,55,207,104,1,153,51,203,100,252,178,0,0},
{234,16,53,90,127,164,201,238,20,233,15,52,89,69,243,25},
{210,134,58,237,161,85,9,188,112,24,203,127,51,70,35,214},
{61,77,93,109,125,141,157,173,189,76,92,108,124,228,98,114},
{202,92,237,127,17,162,52,197,87,240,130,20,165,172,50,195},
{252,31,65,99,133,167,201,235,14,133,167,201,235,201,31,65},
{128,9,145,26,162,43,179,60,196,162,43,179,60,179,9,145},
{135,189,243,42,96,150,204,3,57,235,34,88,142,117,180,234},
{75,28,236,189,142,95,48,1,209,66,19,227,180,171,152,105},
{186,79,227,120,13,161,54,202,95,182,75,223,116,36,222,115},
{223,174,125,76,27,233,184,135,86,244,195,146,97,173,33,239},
{45,188,76,219,107,250,138,26,169,190,78,221,109,60,230,118},
{81,231,126,21,171,66,216,111,6,100,250,145,40,92,221,116},
{128,92,56,20,239,203,167,131,95,203,167,131,95,203,16,235},
{218,152,86,20,209,143,77,11,200,143,77,11,200,143,211,145},
{166,152,138,124,110,96,82,68,54,216,202,188,174,136,221,207},
{188,143,98,53,8,218,173,128,83,31,241,196,151,30,78,33},
{192,211,230,249,13,32,51,70,89,140,159,178,197,124,0,0},
{118,210,47,139,231,68,160,252,89,59,151,243,80,17,70,162},
{178,54,185,61,192,68,199,75,206,166,42,173,49,229,173,49},
{56,112,168,224,25,81,137,193,249,119,175,231,32,107,231,32},
{175,245,60,130,200,15,85,155,225,72,142,212,27,55,77,147},
{186,250,59,123,187,251,60,124,188,246,55,119,183,89,79,143},
{203,233,8,38,68,98,128,158,188,251,26,56,86,238,10,40},
{10,76,142,208,19,85,151,217,28,238,49,115,181,214,212,23},
{150,77,4,186,113,40,222,149,76,87,14,196,123,155,149,76},
{185,93,1,164,72,235,143,51,214,5,168,76,239,169,79,242},
{213,153,93,33,228,168,108,48,243,219,159,99,39,58,157,97},
{169,241,58,130,202,19,91,163,235,70,142,214,31,67,3,75},
{16,142,13,139,10,136,7,133,4,102,228,99,225,171,90,216},
{16,126,236,91,201,56,166,21,131,49,159,14,124,69,46,156},
{248,100,207,59,166,18,125,232,84,5,112,219,71,73,232,84},
{91,149,207,10,68,126,184,242,45,16,74,132,190,90,180,238},
{54,94,134,174,214,254,39,79,119,201,241,26,66,87,13,53},
{210,39,123,207,36,120,204,33,117,18,102,186,15,119,231,60},
{160,155,150,145,140,135,130,125,120,54,49,44,39,182,232,227},
{178,56,189,67,200,78,211,89,222,111,244,122,255,211,114,247},
{73,4,190,121,52,238,169,100,31,34,220,151,82,148,36,222},
{65,126,187,248,54,115,176,237,43,242,48,109,170,226,5,66},
{111,58,5,207,154,101,48,250,197,146,93,40,242,72,107,54},
{28,122,216,55,149,243,82,176,15,117,211,50,144,92,114,208},
{162,62,217,117,17,172,72,227,127,234,134,34,189,239,42,197},
{94,253,157,61,220,124,28,187,91,243,147,51,210,69,240,144},
{224,234,244,254,9,19,29,39,49,197,207,217,227,41,150,160},
{18,39,60,81,102,123,144,165,186,225,246,12,33,59,87,108},
{16,137,3,124,245,111,232,98,219,117,238,104,225,17,105,226},
{86,129,172,215,3,46,89,132,175,226,14,57,100,185,70,113},
{253,76,154,232,55,133,211,34,112,252,75,153,231,206,125,203},
{165,122,79,36,248,205,162,119,76,96,53,10,222,42,202,159},
{202,176,150,124,98,72,46,20,249,96,70,44,18,206,48,22},
{82,254,171,88,5,177,94,11,183,132,49,221,138,223,18,190},
{110,225,85,200,60,175,35,150,10,119,234,94,209,24,95,210},
{20,8,251,239,227,215,203,191,179,198,186,174,162,240,102,90},
{35,202,114,26,193,105,17,184,96,89,1,168,80,87,155,67},
{7,94,181,13,100,187,19,106,193,34,121,208,40,112,98,185},
{178,185,192,199,206,213,220,227,234,154,161,168,175,25,168,175},
{35,147,4,116,228,85,197,54,166,161,18,130,242,137,130,242},
{185,122,59,251,188,125,62,254,191,159,96,33,225,152,129,66},
{1,248,240,232,224,216,208,200,192,192,184,176,168,174,53,45},
{37,177,62,202,87,227,112,252,137,86,226,111,251,52,96,236},
{193,66,194,67,195,68,196,69,197,58,186,59,187,254,234,107},
{26,125,224,68,167,11,110,209,53,96,195,39,138,248,236,80},
{21,34,47,60,73,86,99,112,125,132,145,158,171,27,233,246},
{175,23,126,229,77,180,28,131,234,58,161,9,112,150,80,183},
{21,95,169,243,62,136,210,29,103,19,93,167,241,201,39,113},
{80,47,14,236,203,170,137,104,71,170,137,104,71,170,204,171},
{143,125,107,89,71,53,35,17,254,53,35,17,254,53,87,69},
{5,54,103,152,201,250,44,93,142,193,242,36,85,192,0,0},
{110,52,249,191,133,75,17,214,156,186,128,70,12,24,107,49},
{151,150,149,148,147,146,145,144,143,143,142,141,140,77,30,29},
{130,154,178,202,226,250,19,43,67,63,87,111,135,94,123,147},
{160,132,104,76,48,20,247,219,191,5,232,204,176,100,15,242},
{7,172,82,247,157,67,232,142,52,203,113,23,188,201,42,207},
{22,175,73,226,124,22,175,73,226,0,0,0,0,124,243,141},
{45,164,28,147,11,130,249,113,232,11,130,249,113,164,147,11},
{28,66,104,142,180,218,1,39,77,179,217,255,38,147,0,0},
{26,210,139,68,252,181,110,39,223,163,92,21,205,79,185,114},
{237,162,87,12,192,117,42,222,147,134,59,239,164,70,82,7},
{145,14,138,7,131,255,124,248,117,30,154,23,147,10,95,219},
{121,138,155,172,189,206,223,240,2,189,206,223,240,223,138,155},
{244,57,125,193,6,74,142,210,23,6,74,142,210,142,57,125},
{20,166,57,203,94,240,131,22,168,147,38,184,75,65,152,43},
{252,214,176,138,100,62,24,241,203,159,121,83,45,182,37,254},
{98,133,168,203,238,18,53,88,123,174,209,244,24,38,49,84},
{46,78,110,142,174,206,238,15,47,76,108,140,172,125,120,152},
{75,212,94,231,113,250,132,14,151,49,186,68,205,41,0,0},
{215,6,52,98,144,190,236,27,73,58,104,150,196,37,191,237},
{36,91,146,201,1,56,111,166,221,180,235,35,90,190,51,106},
{93,156,219,27,90,153,216,24,87,136,199,7,70,43,130,193},
{86,40,249,203,157,111,65,19,228,251,205,159,113,78,33,242},
{181,17,108,199,35,126,217,53,144,22,113,204,40,56,53,144},
{62,211,105,254,148,42,191,85,234,132,26,175,69,239,54,203},
{111,44,232,165,98,31,219,152,85,34,222,155,88,239,28,216},
{210,162,114,66,18,225,177,129,81,157,109,61,13,70,28,235},
{179,129,79,29,234,184,134,84,34,215,165,115,65,90,119,69},
{132,21,165,54,198,87,231,120,9,189,78,222,111,183,55,199},
{146,26,161,41,176,56,191,71,206,158,38,173,53,91,34,169},
{28,179,75,226,122,18,169,65,216,114,10,161,57,44,177,73},
{44,222,145,68,246,169,92,15,193,244,167,90,13,98,43,221},
{183,148,113,78,43,8,228,193,158,249,214,179,144,34,243,208},
{241,238,235,232,229,226,223,220,217,158,155,152,149,41,134,131},
{182,117,52,242,177,112,47,237,172,28,218,153,88,60,200,135},
{197,39,136,233,75,172,14,111,208,244,86,183,25,14,181,23},
{201,188,175,162,149,136,123,110,97,148,135,122,109,203,124,111},
{104,190,21,107,193,24,110,196,27,129,215,46,132,47,72,158},
{127,83,39,250,206,162,118,74,30,154,110,66,22,153,187,143},
{52,223,139,55,226,142,58,229,145,193,109,25,196,232,225,141},
{180,200,220,240,5,25,45,65,85,126,146,166,186,69,32,52},
{157,199,241,28,70,112,154,196,238,61,103,145,187,239,40,82},
{27,120,213,51,144,237,75,168,6,135,228,66,159,192,136,229},
{160,63,221,124,27,185,88,246,149,121,24,182,85,113,130,33},
{255,132,9,141,18,150,27,159,36,201,78,210,87,153,149,26},
{184,244,49,109,169,229,34,94,154,25,85,145,205,254,53,113},
{238,40,97,154,211,13,70,127,184,234,36,93,150,50,236,38},
{182,10,93,176,4,87,170,253,81,161,244,72,155,200,75,158},
{159,230,46,117,188,4,75,146,217,54,125,196,12,127,202,18},
{210,64,173,27,136,245,99,208,62,84,193,47,156,220,208,62},
{228,38,103,168,233,43,108,173,238,129,194,4,69,237,155,220},
{95,2,164,71,233,140,47,209,116,89,251,158,65,132,8,170},
{211,242,18,49,80,111,142,173,204,246,22,53,84,241,71,102},
{232,22,67,112,157,202,247,37,82,15,60,105,150,254,2,47},
{104,171,238,50,117,184,251,63,130,68,135,202,14,233,157,224},
{237,198,159,120,81,42,3,219,180,127,88,49,10,165,162,123},
{126,54,237,165,93,21,204,132,60,21,204,132,60,21,157,85},
{192,60,183,51,174,42,165,33,156,42,165,33,156,42,178,46},
{54,218,127,36,200,109,18,182,91,22,186,95,4,129,87,251},
{44,162,25,143,6,124,242,105,223,212,75,193,56,154,54,172},
{92,33,229,170,111,52,248,189,130,79,20,216,157,75,0,0},
{169,192,215,238,6,29,52,75,98,218,241,9,32,80,157,180},
{66,139,212,30,103,176,249,67,140,2,75,148,221,216,132,205},
{129,110,91,72,53,34,15,251,232,210,191,172,153,94,149,130},
{174,46,173,45,172,44,171,43,170,170,42,169,41,137,241,113},
{41,53,65,77,89,101,113,125,137,135,147,159,171,23,165,177},
{15,126,237,93,204,60,171,27,138,60,171,27,138,60,77,188},
{207,198,189,180,171,162,153,144,135,162,153,144,135,162,179,170},
{180,33,141,249,102,210,63,171,24,125,233,86,194,144,15,123},
{54,215,121,27,188,94,255,161,67,36,197,103,9,246,208,114},
{205,9,68,127,186,245,49,108,167,34,93,152,211,5,210,14},
{88,170,252,79,161,243,70,152,234,72,154,236,63,253,232,59},
{11,52,93,134,175,216,2,43,84,3,44,85,126,221,83,124},
{106,8,165,67,224,126,28,185,87,148,50,207,109,6,236,138},
{119,204,34,119,204,34,119,204,34,204,34,119,204,0,34,119},
{247,162,77,247,162,77,247,162,77,162,77,247,162,0,77,247},
{37,33,29,25,21,17,13,9,5,5,1,252,248,251,63,59},
{241,82,178,19,115,211,52,148,244,228,69,165,6,97,213,54},
{55,189,68,202,81,215,94,228,107,238,117,251,130,58,161,40},
{136,58,235,157,79,1,178,100,22,171,93,15,192,247,241,163},
{248,180,112,44,231,163,95,27,214,231,163,95,27,180,44,231},
{133,82,31,235,184,133,82,31,235,0,0,0,0,184,116,65},
{144,206,13,75,137,199,6,68,130,214,21,83,145,204,119,181},
{112,202,37,127,217,52,142,232,67,188,23,113,203,156,162,252},
{231,179,127,75,23,226,174,122,70,19,222,170,118,239,178,126},
{175,9,98,187,21,110,199,33,122,20,109,198,32,202,47,136},
{87,182,22,117,212,52,147,242,82,10,105,200,40,26,96,191},
{88,9,185,106,27,203,124,45,221,239,160,81,2,124,80,1},
{183,84,240,141,42,198,99,255,156,181,82,238,139,89,182,83},
{64,233,147,61,230,144,58,227,141,181,95,9,178,73,138,52},
{232,137,42,202,107,12,172,77,237,55,215,120,25,109,68,228},
{168,249,75,156,237,63,144,225,51,165,246,72,153,59,252,78},
{86,97,108,119,130,141,152,163,174,207,218,229,240,152,213,224},
{113,103,93,83,73,63,53,43,33,156,146,136,126,157,2,247},
{63,85,107,129,151,173,195,217,239,50,72,94,116,195,62,84},
{93,73,53,33,13,248,228,208,188,179,159,139,119,181,126,106},
{102,224,91,213,80,202,69,191,58,201,68,190,57,169,237,104},
{10,127,244,106,223,85,202,64,181,187,49,166,28,160,191,53},
{121,165,209,253,42,86,130,174,218,95,139,183,227,130,119,163},
{167,127,87,47,7,222,182,142,102,84,44,4,219,88,233,193},
{182,6,85,164,243,67,146,225,49,35,114,193,17,31,167,246},
{31,205,124,43,217,136,55,229,148,85,4,178,97,241,213,132},
{35,248,206,164,122,80,38,251,209,233,191,149,107,125,249,207},
{149,127,105,83,61,39,17,250,228,35,13,246,224,162,179,157},
{220,195,170,145,120,95,70,45,20,238,213,188,163,48,190,165},
{193,169,145,121,97,73,49,25,1,39,15,246,222,123,102,78},
{12,185,103,21,194,112,30,203,121,60,233,151,69,77,203,121},
{50,27,4,236,213,190,167,144,121,5,237,214,191,46,151,128},
{183,44,160,21,137,253,114,230,91,33,149,10,126,181,106,222},
{11,225,184,143,102,61,20,234,193,35,249,208,167,171,234,193},
{228,217,206,195,184,173,162,151,140,171,160,149,138,107,243,232},
{21,255,234,213,192,171,150,129,108,120,99,78,57,66,128,107},
{48,216,129,42,210,123,36,204,117,174,87,255,168,121,90,3},
{202,27,107,187,12,92,172,252,77,241,66,146,226,13,120,200},
{51,139,227,60,148,236,69,157,245,254,87,175,8,69,47,135},
{234,154,74,249,169,89,9,184,104,68,243,163,83,76,111,31}
};


//暗号化行列3
unsigned char h3[16][256]={
{161,215,114,66,78,121,65,12,14,180,57,32,103,154,22,29,203,90,5,167,151,207,225,235,23,238,86,179,83,110,217,174,46,123,251,170,122,246,143,1,98,34,51,200,37,220,233,147,20,166,231,212,228,3,60,188,236,27,200,161,230,85,158,43,59,39,54,245,84,68,63,227,233,137,170,85,210,227,155,207,156,111,129,88,10,244,25,71,218,42,42,255,118,75,137,49,247,61,181,102,73,37,53,106,190,98,171,132,22,225,228,208,25,40,245,134,161,65,147,191,143,127,104,218,80,178,126,168,190,12,123,133,163,149,72,194,93,206,175,255,44,152,63,1,175,179,197,150,149,21,209,28,136,255,243,113,35,119,219,125,255,13,93,142,144,191,121,242,236,3,209,1,247,39,56,241,146,4,190,59,62,54,153,49,98,125,223,133,181,108,166,20,18,117,10,226,4,29,251,100,38,160,123,219,49,136,201,226,203,12,3,5,147,84,39,30,17,251,167,208,185,196,179,56,181,3,217,30,203,198,69,154,198,152,172,213,87,219,49,212,130,10,200,233,189,97,70,191,206,228,82,34,198,200,123,11},
{0,215,228,198,37,128,155,36,112,125,167,125,158,108,196,187,44,147,90,86,227,184,202,189,213,139,47,198,170,50,123,70,169,160,253,7,14,162,53,39,235,27,205,115,117,167,59,165,231,109,180,63,128,95,188,2,153,41,167,196,139,197,216,23,102,18,109,137,233,153,249,241,195,72,165,137,15,97,216,204,225,19,32,130,50,51,213,220,59,175,209,205,173,235,168,233,128,53,18,78,91,208,145,85,123,44,43,18,251,138,127,229,132,41,92,8,202,121,44,167,68,238,231,10,229,14,240,245,101,66,189,59,245,186,94,253,115,55,95,213,78,249,145,143,47,231,117,238,138,94,177,47,59,125,151,93,211,15,210,78,244,126,116,223,118,226,198,99,232,230,186,171,141,96,79,76,132,254,117,37,218,37,209,107,210,70,41,178,31,13,152,249,1,97,199,93,55,92,84,105,178,120,233,183,40,124,218,177,225,165,107,184,230,193,199,207,217,15,107,96,131,184,243,37,233,62,65,173,158,120,102,144,255,128,176,158,93,53,36,2,76,36,57,9,107,181,69,66,144,124,158,253,60,117,32,183},
{0,215,213,87,148,186,125,252,167,178,2,72,198,134,204,183,250,86,125,243,61,45,186,11,55,255,241,213,217,112,27,209,132,25,49,233,229,233,80,97,39,132,57,236,64,9,108,4,103,210,249,37,31,136,190,110,19,159,249,70,210,217,103,106,184,230,152,123,91,78,128,123,220,197,36,71,163,178,96,29,84,138,146,84,211,180,118,118,52,20,150,13,133,37,249,80,74,26,170,141,157,150,37,32,143,119,8,40,122,17,45,244,127,88,192,191,187,243,52,27,150,2,160,9,48,220,207,161,240,216,159,129,248,55,229,182,128,16,192,66,187,228,198,70,212,207,241,99,32,142,232,25,158,93,38,45,237,104,200,253,96,244,86,49,38,24,248,31,114,106,81,34,191,12,188,31,204,241,247,166,57,120,142,176,65,208,221,53,149,242,211,118,192,206,55,152,31,142,20,227,73,34,161,66,150,204,233,60,141,113,84,249,56,112,224,209,91,179,43,166,75,231,106,102,25,224,192,246,148,131,192,40,110,173,58,237,171,228,19,195,226,168,129,56,210,45,66,248,254,137,102,210,233,34,182,120},
{0,215,183,249,106,104,19,206,81,75,20,162,65,224,188,243,27,95,121,131,3,115,212,129,242,31,143,85,212,89,47,90,77,30,12,74,66,6,47,134,177,157,212,214,207,88,51,188,66,44,146,209,86,42,210,248,239,28,9,252,79,47,18,83,33,217,228,38,50,1,160,215,183,180,128,219,104,34,95,168,141,255,159,113,36,215,214,160,91,128,14,200,16,91,48,199,194,179,120,26,144,173,191,124,92,34,119,158,18,243,221,37,78,253,110,97,182,142,144,37,8,242,48,132,168,255,183,85,177,208,11,13,2,105,135,52,103,120,71,118,184,67,99,101,135,228,101,12,119,196,65,222,57,151,209,235,73,66,120,102,214,148,246,152,198,195,153,161,238,255,13,143,204,143,64,89,62,32,165,197,241,59,91,77,153,252,64,236,1,194,41,24,222,228,173,243,212,236,195,53,182,151,79,59,20,66,34,153,5,1,112,212,176,13,39,30,254,205,175,23,206,96,68,195,21,74,102,113,50,209,65,218,141,176,192,175,193,45,105,227,241,161,94,75,78,54,186,182,221,39,124,148,183,49,49,71},
{0,215,115,22,181,213,106,80,178,41,136,130,43,20,38,40,173,198,49,64,60,193,3,88,88,10,23,84,88,43,77,184,85,249,133,107,189,222,107,184,66,75,196,70,245,16,1,132,252,63,91,192,94,49,40,159,209,134,247,39,242,181,187,237,168,157,106,31,212,69,136,252,23,123,238,34,197,207,67,3,216,133,50,193,31,190,140,250,120,155,43,39,169,82,134,98,175,139,32,135,126,47,39,36,11,115,187,69,86,206,169,175,203,241,177,36,136,180,182,240,231,215,8,186,16,99,94,139,182,172,255,217,21,110,129,147,242,73,172,136,49,106,191,217,44,97,36,154,231,129,248,110,179,130,20,141,220,179,239,123,132,34,204,208,105,164,180,135,165,160,1,112,91,117,200,20,34,163,168,53,50,191,55,70,28,61,161,167,188,227,121,174,182,56,95,50,18,233,51,213,78,41,162,34,75,170,121,210,183,209,64,197,24,64,199,207,107,208,245,10,119,251,198,10,225,102,69,38,226,15,217,239,81,247,40,60,126,169,68,79,71,139,24,213,58,36,244,94,190,131,13,152,188,64,19,246},
{0,215,230,58,238,166,97,173,249,124,57,255,233,228,249,133,2,58,85,180,23,110,58,124,19,250,251,79,110,72,69,233,114,175,122,92,240,67,134,145,130,188,94,232,195,234,46,162,141,91,192,228,227,172,35,245,104,71,88,146,156,38,141,24,85,9,75,178,84,220,170,63,17,47,231,3,66,79,184,209,5,231,127,216,2,239,135,171,95,123,139,51,232,221,229,207,204,70,220,227,104,21,115,253,223,155,197,5,249,250,97,183,196,135,88,23,31,212,249,236,115,204,247,122,147,170,139,47,17,60,129,254,6,210,178,184,111,72,220,214,244,139,209,59,121,245,197,116,147,212,212,160,165,32,7,115,138,224,175,43,100,198,231,14,166,211,144,43,60,174,170,51,186,45,92,164,254,219,17,89,249,221,201,83,60,39,59,39,42,96,234,175,151,207,92,114,73,31,78,180,244,215,12,211,10,99,153,5,232,194,190,167,47,99,224,209,253,221,103,61,244,196,72,21,74,239,111,65,216,250,2,212,86,138,15,186,78,173,154,217,60,228,88,169,22,56,82,35,49,83,182,216,22,177,68,182},
{0,215,209,78,159,4,91,100,155,187,167,183,152,32,183,224,32,189,147,78,49,101,27,250,181,98,107,23,92,251,181,136,230,235,15,171,140,218,62,7,233,43,121,122,56,106,32,201,72,45,36,6,12,16,212,209,40,73,108,45,129,125,93,50,228,115,161,80,233,146,14,198,188,69,199,221,114,6,63,181,13,78,235,112,168,103,247,129,5,204,2,155,42,32,22,160,213,62,62,107,35,242,96,174,141,180,99,218,162,236,173,86,46,104,21,39,197,222,253,145,139,107,83,154,251,66,164,228,104,87,140,253,63,220,160,77,198,193,57,194,143,75,230,168,149,21,117,23,213,36,69,75,167,202,225,118,4,235,251,58,108,144,156,156,34,38,75,252,69,94,35,70,234,38,97,207,15,29,93,102,251,207,248,189,162,182,219,248,242,66,127,16,114,37,7,248,253,203,7,33,179,25,17,161,171,255,75,212,147,61,151,157,103,190,39,30,30,193,250,85,191,184,39,245,44,140,228,129,73,183,209,236,244,121,175,74,228,62,174,93,228,15,14,31,249,219,97,143,181,145,211,244,73,63,174,135},
{0,215,191,210,70,20,199,33,172,10,2,21,238,189,68,201,58,162,254,70,243,242,247,199,94,59,87,236,30,176,199,195,145,199,227,36,90,215,23,245,119,103,134,130,110,105,169,91,1,14,198,170,109,119,156,163,142,10,16,33,87,195,215,26,191,226,112,73,91,147,131,191,181,199,114,133,179,179,28,171,183,176,133,146,157,32,200,159,37,211,180,80,45,111,80,147,220,150,212,131,176,96,228,193,140,120,224,43,221,1,196,3,60,56,212,130,109,187,56,81,185,212,150,161,113,204,111,125,62,159,88,101,10,185,57,183,205,147,118,140,202,118,115,252,228,10,241,27,100,57,154,70,138,21,235,187,74,205,248,160,5,156,250,102,108,224,92,199,103,167,7,72,176,205,2,254,222,113,205,181,142,39,162,205,177,146,251,14,48,27,73,63,110,231,116,60,29,13,104,2,129,195,246,238,5,220,156,157,144,218,196,62,170,138,199,207,101,21,197,101,113,231,226,97,165,33,216,39,40,101,97,224,88,112,147,152,201,245,251,76,235,54,213,163,87,146,22,2,183,151,188,162,190,207,201,165},
{0,215,99,107,5,68,168,231,9,90,20,151,188,242,159,67,135,80,186,222,96,134,195,131,67,105,53,124,117,108,50,137,215,2,234,152,250,83,168,58,217,4,88,114,179,30,116,209,48,51,136,117,22,211,48,117,28,167,135,8,232,87,48,76,252,192,177,108,50,214,106,230,135,38,130,20,220,111,251,210,121,100,117,13,255,114,230,235,234,74,53,154,164,237,151,196,155,207,9,114,98,68,12,114,228,79,125,35,14,109,62,177,143,106,200,217,84,13,194,216,33,71,57,235,162,124,61,15,118,183,171,95,65,165,71,179,124,25,254,192,236,161,183,130,133,195,101,129,243,187,188,123,22,162,102,193,101,238,71,34,26,67,7,155,168,79,187,153,142,214,113,164,166,58,65,55,140,150,9,242,90,15,35,215,43,242,37,12,17,68,155,202,155,102,60,148,65,144,76,147,40,22,207,3,219,14,154,201,253,106,176,200,130,151,224,209,153,139,4,54,6,96,213,228,79,144,163,162,162,88,72,48,173,130,21,173,77,182,201,245,210,252,124,47,198,23,213,243,90,187,185,165,243,188,206,208},
{0,215,198,189,20,73,215,143,72,176,136,104,67,222,233,246,152,57,6,30,211,44,28,118,102,216,168,208,69,8,38,220,255,66,197,95,249,176,115,181,164,164,133,199,228,113,132,244,105,10,181,154,223,118,201,83,154,13,234,197,254,191,84,98,241,138,36,182,212,10,254,183,22,126,122,245,224,83,135,100,232,82,229,160,161,5,151,229,29,131,105,11,3,246,50,131,131,186,85,161,236,241,146,116,29,50,24,92,50,232,193,41,72,218,217,1,146,51,165,53,195,89,133,73,47,136,132,191,133,38,124,93,30,111,175,149,43,205,160,135,179,32,213,195,17,102,36,245,76,205,216,212,2,234,152,128,104,30,169,41,230,209,73,40,148,47,156,45,84,172,233,101,123,64,102,12,37,232,75,23,53,237,132,202,226,45,182,103,179,178,12,235,27,179,168,142,147,226,150,139,54,128,95,64,140,178,4,19,165,56,159,201,243,6,39,30,95,120,79,179,242,251,86,207,107,111,110,46,103,114,92,103,29,98,99,247,205,89,194,65,33,127,202,35,66,26,15,89,169,181,140,126,154,170,14,24},
{0,215,145,218,80,112,200,138,122,89,57,223,51,63,87,27,117,142,108,223,218,102,149,108,57,87,54,34,63,232,163,193,150,234,18,206,149,201,241,15,112,212,38,231,21,129,38,238,127,247,203,76,200,230,152,79,91,8,192,125,145,169,4,182,150,183,189,65,84,152,79,228,89,95,232,114,86,217,35,30,190,34,222,64,83,28,254,136,54,112,60,15,228,122,58,93,234,197,60,72,222,207,143,59,124,173,153,239,87,168,245,81,246,61,216,115,99,154,80,211,53,126,68,47,149,163,20,54,169,204,20,70,195,87,200,141,97,177,234,108,172,112,228,44,101,37,197,226,80,200,227,145,45,223,99,18,42,208,152,25,239,18,52,168,220,4,176,9,157,17,21,108,158,8,111,151,201,175,169,193,210,115,243,245,144,120,85,25,176,190,91,42,143,195,178,239,35,43,225,17,174,96,158,176,227,9,31,32,212,104,26,26,90,196,199,207,185,241,38,182,77,196,6,231,157,85,6,10,232,47,37,65,90,123,55,121,218,101,206,170,155,64,192,3,62,231,27,220,216,2,148,154,210,245,157,224},
{0,215,63,115,93,173,138,145,247,171,167,202,73,38,109,153,3,134,86,13,110,205,252,151,98,204,134,113,206,90,126,183,55,230,94,183,57,210,87,208,1,165,213,238,102,46,77,31,248,183,255,21,35,14,232,97,148,213,106,208,176,208,248,16,110,113,27,78,233,11,149,57,49,195,70,240,235,88,231,121,147,80,89,121,113,226,20,74,235,213,217,126,157,96,240,59,20,87,16,218,4,161,85,244,138,160,208,238,149,234,191,19,59,194,170,161,246,126,255,51,237,151,30,88,238,240,86,231,42,22,250,106,34,222,106,89,229,230,250,247,19,168,114,58,238,56,117,249,91,51,34,78,156,183,80,110,219,132,57,22,38,157,185,235,231,174,50,246,227,235,74,246,68,1,216,69,116,196,163,195,240,56,188,218,13,33,166,117,105,241,213,140,160,64,201,227,244,177,71,43,92,40,89,9,70,235,18,216,164,135,198,220,185,214,224,209,93,38,164,38,60,184,254,179,235,22,118,144,126,11,200,152,96,191,166,130,2,87,114,206,212,150,250,8,225,186,63,198,129,239,12,51,144,93,59,197},
{0,215,126,149,105,35,27,208,235,154,2,93,75,147,60,84,48,14,165,199,11,146,73,71,89,190,221,127,93,12,125,76,174,119,179,167,151,226,221,21,40,253,238,128,206,82,180,98,77,107,62,232,146,11,32,216,22,93,140,61,95,231,244,215,130,96,184,184,91,221,247,73,73,31,214,8,216,92,124,182,246,128,136,99,139,233,76,72,69,129,124,16,99,177,164,149,211,1,110,181,141,169,117,214,137,31,82,133,75,114,182,15,194,209,10,138,196,165,212,252,100,231,5,183,115,194,92,252,164,217,49,157,88,174,66,9,152,251,178,249,161,177,57,39,76,206,241,120,46,80,6,183,20,72,28,82,121,123,37,96,94,226,19,188,244,197,154,197,190,124,165,217,194,173,110,161,173,19,35,184,134,125,198,74,203,7,58,13,23,24,138,178,177,10,223,158,183,162,191,231,101,30,24,221,255,131,253,176,4,241,9,19,34,176,39,30,20,206,24,130,58,231,85,64,196,202,195,82,153,73,34,67,212,73,122,123,197,10,14,188,59,134,112,203,95,39,107,21,61,241,76,13,132,79,81,119},
{0,215,252,162,185,175,90,10,11,62,20,53,83,9,117,43,39,238,213,184,156,53,79,204,11,8,80,253,2,156,95,23,100,49,152,173,113,92,86,241,52,144,110,36,217,63,85,216,241,116,40,79,16,234,142,49,55,89,105,182,21,80,225,231,7,69,76,244,50,215,3,85,197,116,236,98,205,117,164,122,144,239,216,62,51,132,235,230,166,194,218,217,53,42,86,27,129,97,31,167,158,166,41,100,49,179,165,121,241,39,143,79,19,1,83,102,25,162,191,178,45,148,143,15,90,160,119,1,228,81,199,143,102,161,11,203,59,40,171,200,129,24,146,186,125,117,101,141,252,11,83,12,47,53,163,103,131,221,246,30,51,183,9,191,151,93,67,202,162,108,107,90,157,54,118,230,22,17,8,70,147,96,4,100,31,8,97,220,28,158,157,199,237,217,213,67,177,60,188,14,135,134,34,55,35,16,65,243,103,253,12,217,42,168,199,207,70,166,191,62,200,96,121,217,92,191,93,47,18,97,64,75,20,42,216,73,233,252,125,192,14,45,230,249,53,58,4,199,225,109,32,187,40,195,212,43},
{0,215,229,251,222,41,193,54,88,211,136,234,243,101,172,148,74,168,102,154,127,150,59,2,232,200,115,202,56,119,132,176,28,95,199,238,95,126,251,166,115,147,202,165,231,149,3,190,224,65,131,64,103,111,27,206,92,189,194,242,43,12,224,131,221,213,114,202,212,79,202,82,113,191,115,52,24,63,196,103,6,252,168,190,135,156,14,113,25,234,146,165,215,7,78,186,42,184,106,31,60,143,45,5,39,122,61,212,229,63,89,141,195,113,52,96,224,244,24,142,217,108,71,131,218,119,89,127,99,190,160,76,232,65,211,54,9,204,77,171,209,36,73,231,239,110,36,111,83,126,92,170,177,104,139,101,12,203,160,236,150,69,219,71,45,250,5,201,67,46,235,141,173,207,93,4,72,110,249,86,66,101,226,67,233,161,197,38,76,207,175,3,82,21,18,210,19,28,235,222,162,236,241,63,241,76,35,18,43,88,177,171,196,159,224,209,238,70,212,37,133,251,90,110,240,216,170,233,51,235,63,32,161,184,45,184,129,96,157,207,201,130,199,130,19,44,255,226,167,91,54,222,69,212,23,33},
{0,215,215,16,95,141,188,130,250,5,57,32,32,227,198,31,212,250,226,230,66,97,13,46,53,218,58,97,154,10,195,17,167,112,86,163,78,224,54,44,121,232,239,170,97,112,114,218,247,237,110,92,195,17,176,212,60,29,30,120,106,1,222,183,89,182,53,179,84,68,118,154,190,210,200,96,238,93,155,207,253,118,74,76,228,55,99,24,75,247,123,3,159,142,13,118,123,7,138,117,152,217,168,230,132,157,135,51,198,238,21,8,99,165,64,87,242,216,164,181,241,166,144,198,54,192,236,241,215,219,131,29,170,95,49,128,188,56,129,230,89,126,170,26,220,217,197,150,250,217,93,180,136,255,133,78,222,135,130,252,235,48,92,225,126,219,4,61,176,116,92,59,155,125,207,134,242,152,215,169,115,62,165,2,236,197,150,67,127,17,191,220,75,110,37,180,141,153,168,150,85,77,131,41,159,24,183,239,188,41,77,32,18,224,39,30,106,168,255,242,185,196,231,117,12,214,207,63,6,164,188,177,137,236,106,129,251,41,30,83,68,206,30,215,250,195,182,101,97,10,11,212,218,118,155,105}
};



#define SIZE 262144

typedef union uni {
  unsigned long long int dd[2];
  unsigned int cc[4];
  unsigned short ss[8];
  unsigned char m[16];
} on;

typedef unsigned long long int ull;
typedef unsigned char uc;
ull ff,f,g[256][2],G[16][16][2],c3[4];
unsigned int f2=0xffffffff;
on c1,c2,u,u1,GG,H;
unsigned char e[32];
unsigned char e1[16][16];
unsigned char e2[16][16];
uc d1[16], d2[16],a[16],b[16],c[16];
uc buf[32],buf1[16],buf2[16],buff[SIZE];
uc t[256][256];

int N=256;

//パスワードを数値化する
void code (char str[256]){
  int i,c,d;
  unsigned long long int u=0;

  
  //gets(str);
  i=0;
  do
    {
      c = str[i] & 0xff;
      e[i]=c;
      if((c & 0x80) > 0)
        {
          ++i;
          d = str[i] & 0xff;
          e[i]=d;
          c^=(d<<8);
          printf("'%c%c' %u\n",c,d,c);
        }
      else
        {
          printf("'%c' %d \n",c,c);
        }
      ++i;
    }while(c != '\0');
  printf("\n")
    ;
  for(i=0;i<32;i++)
    printf("%u ",e[i]);
  printf("\n");
  for(i=0;i<8;i++)
    u=(u<<8)^e[i];
  c3[0]=u;u=0;
  for(i=8;i<16;i++)
    u=(u<<8)^e[i];
  c3[1]=u;u=0;
  for(i=16;i<24;i++)
    u=(u<<8)^e[i];
    c3[2]=u;u=0;
  for(i=24;i<32;i++)
    u=(u<<8)^e[i];
  c3[3]=u;
  printf("%llu %llu %llu %llu\n",c3[0],c3[1],c3[2],c3[3]);

  if(c3[0]==0 || c3[1]==0){
    printf("too short passward\n");
    exit(1);
  }
  if(c3[1]>0 && c3[2]==0)
    printf("key length is 128bit\n");
  if(c3[2]>0 && c3[3]==0)
    printf("key length is 192bit\n");
  if(c3[3]>0)
    printf("key length is 256bit\n");
}


//初期化
void init(unsigned long long int uu[4]){

  
  c1.cc[0]=2183266401UL;
  c1.cc[1]=2186346530UL; 
  c1.cc[2]=2183266313UL; 
  c1.cc[3]=2188574773UL;
  c2.cc[0]=2212298975UL; 
  c2.cc[1]=2211905752UL;
  c2.cc[2]=2198339796UL; 
  c2.cc[3]=2210398243UL;
  u.dd[0]=uu[0];
  u.dd[1]=uu[1];
  u1.dd[0]=uu[2];
  u1.dd[1]=uu[3];
  ff=0xf0f0f0f0f0f0f0f0ULL;
  f=0x0f0f0f0f0f0f0f0fULL;
  printf("init\n");

}

//行列を64ビット整数に置き換える
void g64(int n){
int i,j;


  for(i=0;i<n;i++){
    for(j=0;j<2;j++)
      g[i][j]=0;
  }
  for(i=0;i<n;i++){
    for(j=0;j<8;j++)
      g[i][0]=(g[i][0]<<(j*8))^h3[j][i];
    for(j=8;j<16;j++)
      g[i][1]=(g[i][1]<<((j-8)*8))^h3[j][i];
  }
  
}

//128bitデータを撹拌する
on s5(on cc){
  int a[16]={7,3,15,11,5,1,13,9,6,2,14,10,4,0,12,8};
  int i,j;
  unsigned int b=0,c;
  on GG;
  
  
  for(i=0;i<16;i++)
    GG.m[a[i]]=cc.m[i];
  
  for(i=0;i<4;i++)
    b^=(GG.m[i]<<(8*i));
  c=b&0x1f;
  b=(b>>5)^(c<<27);
  for(i=0;i<4;i++){
    GG.m[i]=b&0xff;
    b=(b>>8);
  }
  
  
return GG;
}


//ハッシュ関数
void hash(char fin[256]){
  int i,j;
  char fout[256];
  int line=0,k=0,n=0,read_size;
  unsigned long long int z,zz;
  on dd,dd1;

  g64(256);
  //  scanf("%s",&fin);
  code(fin);
  printf("in hash %llx %llx %llx %llx\n",c3[0],c3[1],c3[2],c3[3]);
  init(c3);

  
  dd.dd[0]=c3[0];
  dd.dd[1]=c3[1];
  dd1.dd[0]=c3[2];
  dd1.dd[1]=c3[3];
  while(k<100){
    if(dd1.dd[0]>0){
      for(i=0;i<4;i++){
        c1.cc[i]=(c1.cc[i]+dd.cc[i]&f2)^c1.cc[(i+1)&0x3];
        c2.cc[i]=(c2.cc[i]+dd1.cc[i]&f2)^c2.cc[(i+1)&0x3];
      }
    }
    if(dd1.dd[0]==0){
      for(i=0;i<4;i++){
        c1.cc[i]=(c1.cc[i]+dd.cc[i]&f2)^c1.cc[(i+1)&0x3];
        c2.cc[i]=(c2.cc[i]+dd.cc[i]&f2)^c2.cc[(i+1)&0x3];
      }
    }
    
    i=c1.cc[0]%256;
    c1.dd[0]^=g[i][0];
    c1.dd[1]^=g[i][1];
    i=c2.dd[0]%256;
    c2.dd[0]^=g[i][0];
    c2.dd[1]^=g[i][1];
    c1=s5(c1);
    c2=s5(c2);

    if(u1.dd[0]==0){
      for(i=0;i<2;i++){
        c1.dd[i]^=u.dd[i];
        c2.dd[i]^=c1.dd[i];
      }
    }
    if(u1.dd[0]>0){
      for(i=0;i<2;i++){
        c1.dd[i]^=u.dd[i];
        c2.dd[i]^=u1.dd[i];
      }
    }
    k++;
    printf("%d ",k);
  }
  for(i=0;i<16;i++){
    a[i]=c1.m[i];
    b[i]=c2.m[i];
  }
    printf("%02x %02x %02x %02x %02x %02x %02x %02x\n",c1.cc[0],c1.cc[1],c1.cc[2],c1.cc[3],c2.cc[0],c2.cc[1],c2.cc[2],c2.cc[3]);
  
}

//有限体の乗算
int mlt(x, y){

    if(x==0||y==0)
        return 0;
    
    return ((x+y-2)&255)+1;
}

//有限体の演算結果を256*256の行列に格納する
void table(){
  int i,j;
  
  for(i=0;i<256;i++){
    for(j=0;j<256;j++)
      t[i][j]=GF[mlt(i,j)];
  }
  
}

//文字列用撹拌コード
char s55(unsigned char cc[16]){
  int a[16]={7,3,15,11,5,1,13,9,6,2,14,10,4,0,12,8};
  int i,j;
  unsigned int b=0,c;
  char GG[16];
  
  
  for(i=0;i<16;i++)
    GG[a[i]]=cc[i];
  
  for(i=0;i<4;i++)
    b^=(GG[i]<<(8*i));
  c=b&0x1f;
  b=(b>>5)^(c<<27);
  for(i=0;i<4;i++){
    GG[i]=b&0xff;
    b=(b>>8);
  }
  

return *GG;
}

//パスワードで確率的暗号化をする
void ul(unsigned long long int un[4]){
int i=0;

  un[0]^=(u.dd[0]+un[0])&f2;
  un[1]^=(u.dd[1]+un[1])&f2;
  un[2]^=(u1.dd[0]+un[2])&f2;
  un[3]^=(u1.dd[1]+un[3])&f2;
  u.dd[1]^=un[i&0x3];
  u.dd[0]^=un[(i+1)&0x3];
  u1.dd[1]^=un[(i+2)&0x3];
  u1.dd[0]^=un[(i+3)&0x3];
  u=s5(u);
  u1=s5(u1);

}


int main(int argc,char *argv[]){
int sum=0;
char *key1="あっふんあかんて";
char *key2="タメサレルダイチ";
int j=0,i=0,k=0,fd,read_size;
unsigned char  count=0,count2=0,o,p;
FILE *fp,*fq;
int l,ll;
unsigned short m;
char fin[80],fout[80];
  
  __m128i *pa = (__m128i*)a; __m128i *pb = (__m128i*)b; __m128i *pc = (__m128i*)c; 
  __m128i *pd1= (__m128i*)d1;__m128i *pd2= (__m128i*)d2;__m128i *pbuf=(__m128i*)buf;
  __m128i *pbuf2=(__m128i*)buf2;
  __m128i va, vb, vc, vd1, vd2; 
  
  printf("\nclock=%u\n",clock());
   if(argv[1]==0){
    printf("usage : grs infile outfile password\n");
    exit(1);
  }
  fp=fopen(argv[2],"wb");
  fq=fopen(argv[1],"rb");

if(fq==NULL){
printf("指定されたファイルが存在しません\n");
exit(1);
}
  hash(argv[3]);
  
  for(i=0;i<16;i++){
    d1[i]=0; d2[i]=0;
  }
  
  table();

  while((read_size=fread(buff,1,SIZE,fq))){
    for(k=0;k<SIZE/32;k++){
      for(i=0;i<32;i++)
        buf[i]=buff[32*k+i];
      ul(c3);
    for(j=0;j<16;j++){
      o=FG[a[j]]^FG[u1.m[j]];
      p=FG[b[j]]^FG[u.m[j]];
    
      for(i=0;i<16;i++){
        d1[j]^=t[o][h1[p][i]];
        d2[j]^=t[o][h2[p][i]];
      }
      buf[j]=d1[j]; 
      buf[j+16]=d2[j];
    }

      _mm_storeu_si128((__m128i*)a,_mm_xor_si128(_mm_loadu_si128((__m128i*)a),_mm_and_si128( _mm_add_epi8(_mm_loadu_si128((__m128i*)d1),_mm_loadu_si128((__m128i*)c)),_mm_set1_epi8(0x0ff)))); 
      _mm_storeu_si128((__m128i*)b,_mm_xor_si128(_mm_loadu_si128((__m128i*)b),_mm_and_si128( _mm_add_epi8(_mm_loadu_si128((__m128i*)d2),_mm_loadu_si128((__m128i*)c)),_mm_set1_epi8(0x0ff)))); 


      for(i=0;i<32;i++)
        buff[32*k+i]=buf[i];
    }
      fwrite(buff,1,read_size,fp);
  }
  
  printf("\nclock=%u\n",clock());
  fclose(fp);
  fclose(fq);

return 0;
}


Output:
In function 'code':
Line 623: warning: incompatible implicit declaration of built-in function 'exit'
In function 'main':
Line 837: error: '__m128i' undeclared (first use in this function)
Line 837: error: (Each undeclared identifier is reported only once
Line 837: error: for each function it appears in.)
Line 837: error: 'pa' undeclared (first use in this function)
Line 837: error: expected expression before ')' token
Line 837: error: 'pb' undeclared (first use in this function)
Line 837: error: expected expression before ')' token
Line 837: error: 'pc' undeclared (first use in this function)
Line 837: error: expected expression before ')' token
Line 838: error: 'pd1' undeclared (first use in this function)
Line 838: error: expected expression before ')' token
Line 838: error: 'pd2' undeclared (first use in this function)
Line 838: error: expected expression before ')' token
Line 838: error: 'pbuf' undeclared (first use in this function)
Line 838: error: expected expression before ')' token
Line 839: error: 'pbuf2' undeclared (first use in this function)
Line 839: error: expected expression before ')' token
Line 840: error: expected ';' before 'va'
Line 845: warning: incompatible implicit declaration of built-in function 'exit'
Line 852: warning: incompatible implicit declaration of built-in function 'exit'
Line 879: error: expected expression before ')' token
Line 880: error: expected expression before ')' token


Create a new paste based on this one


Comments: