cryptocol 0.19.8

A cryptographic library that includes big number arithmetic operations, hash algorithms, symmetric-key cryptographic encryption/decryption algorithms, asymmetric-key (public-key) cryptographic encryption/decryption algorithms, pseudo random number generators, etc. Hash algorithms includes MD4, MD5, SHA224, SHA256, SHA384, SHA512, SHA3, etc. Symmetric key encryption algorithms include DES, AES, etc. Public key encryption algorithms include RSA, ECC, etc.
Documentation
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
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
// Copyright 2024, 2025 PARK Youngho.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// https://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or https://opensource.org/licenses/MIT>, at your option.
// This file may not be copied, modified, or distributed
// except according to those terms.


// #![allow(missing_docs)]
// #![allow(unused_must_use)]
// #![allow(dead_code)]
// #![allow(unused_variables)]
// #![warn(rustdoc::missing_doc_code_examples)]


use crate::number::{ SmallUInt, IntUnion, LongUnion };

// Converts bit number into 0-based bit number in Little Endianness.
macro_rules! convert {
    ($p:expr) => {
        ((($p - 1) >> 3) << 3) + (7 - (($p - 1) & 0b111))
    };
}

macro_rules! make_FP {
    () => {
        {
            let mut out = [0_u8; 64];
            let mut i = 0_u8;
            while i < 64
            {
                out[Self::IP[i as usize] as usize] = i;
                i += 1;
            }
            out
        }
    }
}

macro_rules! permutate_data {
    ($me:expr, $permut:expr) => {
        let data = $me.block.get();
        let mut permuted = 0_u64;
        let mut idx = 0_usize;
        // $permut and pos are already changed to be 0-based in little endianness.
        for pos in $permut
        {
            if data.is_bit_set_(pos as u32)
                { permuted |= 1_u64 << idx; } // ((7 - idx % 8) + (idx / 8) * 8); }
            idx += 1;
        }
        $me.block.set(permuted);
    };
    // permutate_data!(Self::IP);
    //
    // let data = self.block.get();
    // let mut permuted = 0_u64;
    // let mut idx = 0_usize;
    // // IP and pos are already changed to be 0-based in little endianness.
    // for pos in Self::IP
    // {
    //     if data.is_bit_set_(pos as usize)
    //         { permuted |= 1_u64 << idx; } // ((7 - idx % 8) + (idx / 8) * 8); }
    //     idx += 1;
    // }
    // self.block.set(permuted);

    ($permut:expr, $type:ty, $right:expr) => {
        {
            let mut permuted = 0 as $type;
            let mut idx = 0_usize;
            // $permut and pos are already changed to be 0-based in little endianness.
            for pos in $permut
            {
                if $right.is_bit_set_(pos as u32)
                    { permuted |= 1 as $type << idx; } // ((7 - idx % 8) + (idx / 8) * 8); }
                idx += 1;
            }
            permuted
        }
    };
    // permutate_data!(Self::TP, u32, right);
    //
    // let mut permuted = 0_u32;
    // let mut idx = 0_usize;
    // // TP and pos are already changed to be 0-based in little endianness.
    // for pos in Self::TP
    // {
    //     if right.is_bit_set_(pos as usize)
    //         { permuted |= 1 << idx; }
    //     idx += 1;
    // }
    // permuted
}

macro_rules! shift_right_union {
    ($u:expr, $n:expr) => {
        let mut carry = 0_u8;
        for i in 0..4
        {
            let tmp = $u.get_ubyte_(i) << (8 - $n);
            $u.set_ubyte_(i, ($u.get_ubyte_(i) >> $n) | carry);
            carry = tmp;
        }
    };
}

macro_rules! shift_left_union {
    ($u:expr, $n:expr) => {
        let mut carry = 0_u8;
        for i in 0..4
        {
            let tmp = $u.get_ubyte_(3 - i) >> (8 - $n);
            $u.set_ubyte_(3 - i, ($u.get_ubyte_(3 - i) << $n) | carry);
            carry = tmp;
        }
    };
    ($u:expr, $n:expr, $size:expr) => {
        let mut carry = 0_u8;
        for i in 0..$size
        {
            let tmp = $u.get_ubyte_($size - 1 - i) >> (8 - $n);
            $u.set_ubyte_($size - 1 - i, ($u.get_ubyte_($size - 1 - i) << $n) | carry);
            carry = tmp;
        }
    };
}

macro_rules! rotate_halfkey {
    ($u:expr, $even:expr) => {
        let n = if $even {2} else {1};
        let mut carry = ($u.get_ubyte_(0) >> (4 - n)) & 0b11110000;
        for i in 0..4
        {
            let tmp = $u.get_ubyte_(3 - i) >> (8 - n);
            $u.set_ubyte_(3 - i, ($u.get_ubyte_(3 - i) << n) | carry);
            carry = tmp;
        }
    };
}

macro_rules! slice_index {
    ($indices:expr, $array:expr) => {
        let mut idx = LongUnion::new_with($indices);
        for i in 0..8_usize
        {
            $array[i] = ((idx.get_ubyte_(0) & 0b_111_111_00_u8) >> 2) as usize;
            shift_left_union!(idx, 6, 6);
        }
    };
}

macro_rules! combine_pieces {
    ($body:expr, $piece:expr) => {
        $body >>= 8;
        $body |= ($piece << 24);
    };
}

// macro_rules! des_pre_encrypt_into_vec {
//     ($to:expr, $length_in_bytes:expr, $type:ty) => {
//         let len = ($length_in_bytes + 1).next_multiple_of(8_u64) as usize / <$type>::size_in_bytes() as usize;
//         $to.truncate(len);
//         $to.resize(len + 1, <$type>::zero());
//     };
//     // des_pre_encrypt_into_vec!(cipher, length_in_bytes, T);
//     //
//     // let mut len = if T::size_in_bytes() == 16 {16_usize} else {8};
//     // len = (length_in_bytes + 1).next_multiple_of(len as u64) as usize / T::size_in_bytes();
//     // cipher.truncate(len - 1);
//     // cipher.resize(len, T::zero());
// }
// pub(super) use des_pre_encrypt_into_vec;

// macro_rules! des_pre_decrypt_into_vec {
//     ($to:expr, $length_in_bytes:expr, $type:ty) => {
//         let len = $length_in_bytes as usize / <$type>::size_in_bytes() as usize;
//         $to.truncate(len - 1);
//         $to.resize(len, <$type>::zero());
//     };
// }
// pub(super) use des_pre_decrypt_into_vec;

// macro_rules! des_pre_decrypt_into_vec_no_padding {
//     ($to:expr, $length_in_bytes:expr, $type:ty) => {
//         let len = $length_in_bytes as usize / <$type>::size_in_bytes() as usize;
//         $to.truncate(len);
//         $to.resize(len, <$type>::zero());
//     };
// }
// pub(super) use des_pre_decrypt_into_vec_no_padding;

// macro_rules! des_pre_encrypt_into_array {
//     ($to:expr, $length_in_bytes:expr, $type:ty) => {
//         let mut len = if <$type>::size_in_bytes() == 16 {16_usize} else {8};
//         len = ($length_in_bytes + 1).next_multiple_of(len as u64) as usize / <$type>::size_in_bytes() as usize;
//         for i in len - 1..$to.len()
//             { $to[i] = <$type>::zero(); }
//     };
//     // des_pre_encrypt_into_array!(cipher, length_in_bytes, T);
//     //
//     // let mut len = if T::size_in_bytes() == 16 {16_usize} else {8};
//     // len = (length_in_bytes + 1).next_multiple_of(len as u64) as usize / T::size_in_bytes();
//     // for i in len..M
//     //     { cipher[i] = T::zero(); }
// }
// pub(super) use des_pre_encrypt_into_array;

// macro_rules! des_pre_decrypt_into_array {
//     ($to:expr, $length_in_bytes:expr, $type:ty) => {
//         let len = $length_in_bytes as usize / <$type>::size_in_bytes() as usize;
//         for i in len - 1..$to.len()
//             { $to[i] = <$type>::zero(); }
//     };
// }
// pub(super) use des_pre_decrypt_into_array;

// macro_rules! des_pre_decrypt_into_array_no_padding {
//     ($to:expr, $length_in_bytes:expr, $type:ty) => {
//         let len = $length_in_bytes as usize / <$type>::size_in_bytes() as usize;
//         for i in len..$to.len()
//             { $to[i] = <$type>::zero(); }
//     };
// }
// pub(super) use des_pre_decrypt_into_array_no_padding;



/// You have freedom of changing EP01 ~ EP48, TP01 ~ TP32, and S000 ~ S763.
/// You can change the DES algorithm by simply changing the generic parameters
/// - EP01 ~ EP48: Expansion permutation constants. They are 1-based. For
///   example, `EP01 = 28` means that the 28th bit of data is moved to the first
///   bit of the data which is MSB at expansion permutation. They expand the
///   32-bit right-half data from the Feistel structure of the corresponding
///   round into 48 bits in order to perform XOR (exclusive OR) with the
///   corresponding 48-bit round key. When you change these constants, you have
///   to remember that you should included all the bits. You cannot drop any
///   bit. Your dropping any bit will surely kill the whole DES
///   encryption/decryption algorithm.
/// - TP01 ~ TP32: Translation permutation constans.  They are 1-based. For
///   example, `TP01 = 16` means that the 16th bit of data is moved to the
///   first bit of the data which is MSB at translation permutation. You can
///   change translation permutation wire by changing these constants. The
///   change of these constants does not change the security strength. However,
///   when you change these constants, you have to remember that you should
///   included all the bits. You cannot drop any bit. Your dropping any bit will
///   surely kill the whole DES encryption/decryption algorithm.
/// - S000 ~ S763: S-Box constants. Its index such as 000, 212, etc. is
///   0-based. S0XX means S-Box 0, S1XX means S-Box 1, and so on. S000 is the
///   first element of S-Box 0.
///   According to [the document](https://page.math.tu-berlin.de/~kant/teaching/hess/krypto-ws2006/des.htm),
///   the input six bits determines the output of S-Box. The first and the last
///   bit of the six bits represent in base 2 a number in the decimal range 0 to
///   3 (or binary 00 to 11) which is row number. The rest middle four bits
///   represent in base 2 a number in the decimal range 0 to 15 (binary 0000 to
///   1111) which is column number. It is considered that the DES designers
///   explained the S-box structure _unnecessarily too complicated_. The
///   above-described S-box indexing way looks two dimensional, but actually is
///   one dimensional. So, in this crate, S-boxes are implemented to be
///   two-dimensional array which is an array of S-boxes. Each S-box is an array
///   of 64 four-bit numbers. The input six-bit number is used as the index of
///   the one-dimensional array of these 64 four-bit numbers. So, the S-box
///   tables have been rearranged to be the one-dimensional array. You can cange
///   S-Box by changing these constants. However, you have know that *the change
///   of these constants may hurt the security a lot*. And the principle of
///   S-box has been unknown so far.
#[allow(non_camel_case_types)]
pub type DES_F<
    const EP01: u8 = 32, const EP02: u8 = 01, const EP03: u8 = 02, const EP04: u8 = 03,
    const EP05: u8 = 04, const EP06: u8 = 05, const EP07: u8 = 04, const EP08: u8 = 05,
    const EP09: u8 = 06, const EP10: u8 = 07, const EP11: u8 = 08, const EP12: u8 = 09,
    const EP13: u8 = 08, const EP14: u8 = 09, const EP15: u8 = 10, const EP16: u8 = 11,
    const EP17: u8 = 12, const EP18: u8 = 13, const EP19: u8 = 12, const EP20: u8 = 13,
    const EP21: u8 = 14, const EP22: u8 = 15, const EP23: u8 = 16, const EP24: u8 = 17,
    const EP25: u8 = 16, const EP26: u8 = 17, const EP27: u8 = 18, const EP28: u8 = 19,
    const EP29: u8 = 20, const EP30: u8 = 21, const EP31: u8 = 20, const EP32: u8 = 21,
    const EP33: u8 = 22, const EP34: u8 = 23, const EP35: u8 = 24, const EP36: u8 = 25,
    const EP37: u8 = 24, const EP38: u8 = 25, const EP39: u8 = 26, const EP40: u8 = 27,
    const EP41: u8 = 28, const EP42: u8 = 29, const EP43: u8 = 28, const EP44: u8 = 29,
    const EP45: u8 = 30, const EP46: u8 = 31, const EP47: u8 = 32, const EP48: u8 = 01,
    const TP01: u8 = 16, const TP02: u8 = 07, const TP03: u8 = 20, const TP04: u8 = 21,
    const TP05: u8 = 29, const TP06: u8 = 12, const TP07: u8 = 28, const TP08: u8 = 17,
    const TP09: u8 = 01, const TP10: u8 = 15, const TP11: u8 = 23, const TP12: u8 = 26,
    const TP13: u8 = 05, const TP14: u8 = 18, const TP15: u8 = 31, const TP16: u8 = 10,
    const TP17: u8 = 02, const TP18: u8 = 08, const TP19: u8 = 24, const TP20: u8 = 14,
    const TP21: u8 = 32, const TP22: u8 = 27, const TP23: u8 = 03, const TP24: u8 = 09,
    const TP25: u8 = 19, const TP26: u8 = 13, const TP27: u8 = 30, const TP28: u8 = 06,
    const TP29: u8 = 22, const TP30: u8 = 11, const TP31: u8 = 04, const TP32: u8 = 25,
    const S000: u8 = 0xe, const S001: u8 = 0x0, const S002: u8 = 0x4, const S003: u8 = 0xf,
    const S004: u8 = 0xd, const S005: u8 = 0x7, const S006: u8 = 0x1, const S007: u8 = 0x4,
    const S008: u8 = 0x2, const S009: u8 = 0xe, const S010: u8 = 0xf, const S011: u8 = 0x2,
    const S012: u8 = 0xb, const S013: u8 = 0xd, const S014: u8 = 0x8, const S015: u8 = 0x1,
    const S016: u8 = 0x3, const S017: u8 = 0xa, const S018: u8 = 0xa, const S019: u8 = 0x6,
    const S020: u8 = 0x6, const S021: u8 = 0xc, const S022: u8 = 0xc, const S023: u8 = 0xb,
    const S024: u8 = 0x5, const S025: u8 = 0x9, const S026: u8 = 0x9, const S027: u8 = 0x5,
    const S028: u8 = 0x0, const S029: u8 = 0x3, const S030: u8 = 0x7, const S031: u8 = 0x8,
    const S032: u8 = 0x4, const S033: u8 = 0xf, const S034: u8 = 0x1, const S035: u8 = 0xc,
    const S036: u8 = 0xe, const S037: u8 = 0x8, const S038: u8 = 0x8, const S039: u8 = 0x2,
    const S040: u8 = 0xd, const S041: u8 = 0x4, const S042: u8 = 0x6, const S043: u8 = 0x9,
    const S044: u8 = 0x2, const S045: u8 = 0x1, const S046: u8 = 0xb, const S047: u8 = 0x7,
    const S048: u8 = 0xf, const S049: u8 = 0x5, const S050: u8 = 0xc, const S051: u8 = 0xb,
    const S052: u8 = 0x9, const S053: u8 = 0x3, const S054: u8 = 0x7, const S055: u8 = 0xe,
    const S056: u8 = 0x3, const S057: u8 = 0xa, const S058: u8 = 0xa, const S059: u8 = 0x0,
    const S060: u8 = 0x5, const S061: u8 = 0x6, const S062: u8 = 0x0, const S063: u8 = 0xd,
    const S100: u8 = 0xf, const S101: u8 = 0x3, const S102: u8 = 0x1, const S103: u8 = 0xd,
    const S104: u8 = 0x8, const S105: u8 = 0x4, const S106: u8 = 0xe, const S107: u8 = 0x7,
    const S108: u8 = 0x6, const S109: u8 = 0xf, const S110: u8 = 0xb, const S111: u8 = 0x2,
    const S112: u8 = 0x3, const S113: u8 = 0x8, const S114: u8 = 0x4, const S115: u8 = 0xe,
    const S116: u8 = 0x9, const S117: u8 = 0xc, const S118: u8 = 0x7, const S119: u8 = 0x0,
    const S120: u8 = 0x2, const S121: u8 = 0x1, const S122: u8 = 0xd, const S123: u8 = 0xa,
    const S124: u8 = 0xc, const S125: u8 = 0x6, const S126: u8 = 0x0, const S127: u8 = 0x9,
    const S128: u8 = 0x5, const S129: u8 = 0xb, const S130: u8 = 0xa, const S131: u8 = 0x5,
    const S132: u8 = 0x0, const S133: u8 = 0xd, const S134: u8 = 0xe, const S135: u8 = 0x8,
    const S136: u8 = 0x7, const S137: u8 = 0xa, const S138: u8 = 0xb, const S139: u8 = 0x1,
    const S140: u8 = 0xa, const S141: u8 = 0x3, const S142: u8 = 0x4, const S143: u8 = 0xf,
    const S144: u8 = 0xd, const S145: u8 = 0x4, const S146: u8 = 0x1, const S147: u8 = 0x2,
    const S148: u8 = 0x5, const S149: u8 = 0xb, const S150: u8 = 0x8, const S151: u8 = 0x6,
    const S152: u8 = 0xc, const S153: u8 = 0x7, const S154: u8 = 0x6, const S155: u8 = 0xc,
    const S156: u8 = 0x9, const S157: u8 = 0x0, const S158: u8 = 0x3, const S159: u8 = 0x5,
    const S160: u8 = 0x2, const S161: u8 = 0xe, const S162: u8 = 0xf, const S163: u8 = 0x9,
    const S200: u8 = 0xa, const S201: u8 = 0xd, const S202: u8 = 0x0, const S203: u8 = 0x7,
    const S204: u8 = 0x9, const S205: u8 = 0x0, const S206: u8 = 0xe, const S207: u8 = 0x9,
    const S208: u8 = 0x6, const S209: u8 = 0x3, const S210: u8 = 0x3, const S211: u8 = 0x4,
    const S212: u8 = 0xf, const S213: u8 = 0x6, const S214: u8 = 0x5, const S215: u8 = 0xa,
    const S216: u8 = 0x1, const S217: u8 = 0x2, const S218: u8 = 0xd, const S219: u8 = 0x8,
    const S220: u8 = 0xc, const S221: u8 = 0x5, const S222: u8 = 0x7, const S223: u8 = 0xe,
    const S224: u8 = 0xb, const S225: u8 = 0xc, const S226: u8 = 0x4, const S227: u8 = 0xb,
    const S228: u8 = 0x2, const S229: u8 = 0xf, const S230: u8 = 0x8, const S231: u8 = 0x1,
    const S232: u8 = 0xd, const S233: u8 = 0x1, const S234: u8 = 0x6, const S235: u8 = 0xa,
    const S236: u8 = 0x4, const S237: u8 = 0xd, const S238: u8 = 0x9, const S239: u8 = 0x0,
    const S240: u8 = 0x8, const S241: u8 = 0x6, const S242: u8 = 0xf, const S243: u8 = 0x9,
    const S244: u8 = 0x3, const S245: u8 = 0x8, const S246: u8 = 0x0, const S247: u8 = 0x7,
    const S248: u8 = 0xb, const S249: u8 = 0x4, const S250: u8 = 0x1, const S251: u8 = 0xf,
    const S252: u8 = 0x2, const S253: u8 = 0xe, const S254: u8 = 0xc, const S255: u8 = 0x3,
    const S256: u8 = 0x5, const S257: u8 = 0xb, const S258: u8 = 0xa, const S259: u8 = 0x5,
    const S260: u8 = 0xe, const S261: u8 = 0x2, const S262: u8 = 0x7, const S263: u8 = 0xc,
    const S300: u8 = 0x7, const S301: u8 = 0xd, const S302: u8 = 0xd, const S303: u8 = 0x8,
    const S304: u8 = 0xe, const S305: u8 = 0xb, const S306: u8 = 0x3, const S307: u8 = 0x5,
    const S308: u8 = 0x0, const S309: u8 = 0x6, const S310: u8 = 0x6, const S311: u8 = 0xf,
    const S312: u8 = 0x9, const S313: u8 = 0x0, const S314: u8 = 0xa, const S315: u8 = 0x3,
    const S316: u8 = 0x1, const S317: u8 = 0x4, const S318: u8 = 0x2, const S319: u8 = 0x7,
    const S320: u8 = 0x8, const S321: u8 = 0x2, const S322: u8 = 0x5, const S323: u8 = 0xc,
    const S324: u8 = 0xb, const S325: u8 = 0x1, const S326: u8 = 0xc, const S327: u8 = 0xa,
    const S328: u8 = 0x4, const S329: u8 = 0xe, const S330: u8 = 0xf, const S331: u8 = 0x9,
    const S332: u8 = 0xa, const S333: u8 = 0x3, const S334: u8 = 0x6, const S335: u8 = 0xf,
    const S336: u8 = 0x9, const S337: u8 = 0x0, const S338: u8 = 0x0, const S339: u8 = 0x6,
    const S340: u8 = 0xc, const S341: u8 = 0xa, const S342: u8 = 0xb, const S343: u8 = 0x1,
    const S344: u8 = 0x7, const S345: u8 = 0xd, const S346: u8 = 0xd, const S347: u8 = 0x8,
    const S348: u8 = 0xf, const S349: u8 = 0x9, const S350: u8 = 0x1, const S351: u8 = 0x4,
    const S352: u8 = 0x3, const S353: u8 = 0x5, const S354: u8 = 0xe, const S355: u8 = 0xb,
    const S356: u8 = 0x5, const S357: u8 = 0xc, const S358: u8 = 0x2, const S359: u8 = 0x7,
    const S360: u8 = 0x8, const S361: u8 = 0x2, const S362: u8 = 0x4, const S363: u8 = 0xe,
    const S400: u8 = 0x2, const S401: u8 = 0xe, const S402: u8 = 0xc, const S403: u8 = 0xb,
    const S404: u8 = 0x4, const S405: u8 = 0x2, const S406: u8 = 0x1, const S407: u8 = 0xc,
    const S408: u8 = 0x7, const S409: u8 = 0x4, const S410: u8 = 0xa, const S411: u8 = 0x7,
    const S412: u8 = 0xb, const S413: u8 = 0xd, const S414: u8 = 0x6, const S415: u8 = 0x1,
    const S416: u8 = 0x8, const S417: u8 = 0x5, const S418: u8 = 0x5, const S419: u8 = 0x0,
    const S420: u8 = 0x3, const S421: u8 = 0xf, const S422: u8 = 0xf, const S423: u8 = 0xa,
    const S424: u8 = 0xd, const S425: u8 = 0x3, const S426: u8 = 0x0, const S427: u8 = 0x9,
    const S428: u8 = 0xe, const S429: u8 = 0x8, const S430: u8 = 0x9, const S431: u8 = 0x6,
    const S432: u8 = 0x4, const S433: u8 = 0xb, const S434: u8 = 0x2, const S435: u8 = 0x8,
    const S436: u8 = 0x1, const S437: u8 = 0xc, const S438: u8 = 0xb, const S439: u8 = 0x7,
    const S440: u8 = 0xa, const S441: u8 = 0x1, const S442: u8 = 0xd, const S443: u8 = 0xe,
    const S444: u8 = 0x7, const S445: u8 = 0x2, const S446: u8 = 0x8, const S447: u8 = 0xd,
    const S448: u8 = 0xf, const S449: u8 = 0x6, const S450: u8 = 0x9, const S451: u8 = 0xf,
    const S452: u8 = 0xc, const S453: u8 = 0x0, const S454: u8 = 0x5, const S455: u8 = 0x9,
    const S456: u8 = 0x6, const S457: u8 = 0xa, const S458: u8 = 0x3, const S459: u8 = 0x4,
    const S460: u8 = 0x0, const S461: u8 = 0x5, const S462: u8 = 0xe, const S463: u8 = 0x3,
    const S500: u8 = 0xc, const S501: u8 = 0xa, const S502: u8 = 0x1, const S503: u8 = 0xf,
    const S504: u8 = 0xa, const S505: u8 = 0x4, const S506: u8 = 0xf, const S507: u8 = 0x2,
    const S508: u8 = 0x9, const S509: u8 = 0x7, const S510: u8 = 0x2, const S511: u8 = 0xc,
    const S512: u8 = 0x6, const S513: u8 = 0x9, const S514: u8 = 0x8, const S515: u8 = 0x5,
    const S516: u8 = 0x0, const S517: u8 = 0x6, const S518: u8 = 0xd, const S519: u8 = 0x1,
    const S520: u8 = 0x3, const S521: u8 = 0xd, const S522: u8 = 0x4, const S523: u8 = 0xe,
    const S524: u8 = 0xe, const S525: u8 = 0x0, const S526: u8 = 0x7, const S527: u8 = 0xb,
    const S528: u8 = 0x5, const S529: u8 = 0x3, const S530: u8 = 0xb, const S531: u8 = 0x8,
    const S532: u8 = 0x9, const S533: u8 = 0x4, const S534: u8 = 0xe, const S535: u8 = 0x3,
    const S536: u8 = 0xf, const S537: u8 = 0x2, const S538: u8 = 0x5, const S539: u8 = 0xc,
    const S540: u8 = 0x2, const S541: u8 = 0x9, const S542: u8 = 0x8, const S543: u8 = 0x5,
    const S544: u8 = 0xc, const S545: u8 = 0xf, const S546: u8 = 0x3, const S547: u8 = 0xa,
    const S548: u8 = 0x7, const S549: u8 = 0xb, const S550: u8 = 0x0, const S551: u8 = 0xe,
    const S552: u8 = 0x4, const S553: u8 = 0x1, const S554: u8 = 0xa, const S555: u8 = 0x7,
    const S556: u8 = 0x1, const S557: u8 = 0x6, const S558: u8 = 0xd, const S559: u8 = 0x0,
    const S560: u8 = 0xb, const S561: u8 = 0x8, const S562: u8 = 0x6, const S563: u8 = 0xd,
    const S600: u8 = 0x4, const S601: u8 = 0xd, const S602: u8 = 0xb, const S603: u8 = 0x0,
    const S604: u8 = 0x2, const S605: u8 = 0xb, const S606: u8 = 0xe, const S607: u8 = 0x7,
    const S608: u8 = 0xf, const S609: u8 = 0x4, const S610: u8 = 0x0, const S611: u8 = 0x9,
    const S612: u8 = 0x8, const S613: u8 = 0x1, const S614: u8 = 0xd, const S615: u8 = 0xa,
    const S616: u8 = 0x3, const S617: u8 = 0xe, const S618: u8 = 0xc, const S619: u8 = 0x3,
    const S620: u8 = 0x9, const S621: u8 = 0x5, const S622: u8 = 0x7, const S623: u8 = 0xc,
    const S624: u8 = 0x5, const S625: u8 = 0x2, const S626: u8 = 0xa, const S627: u8 = 0xf,
    const S628: u8 = 0x6, const S629: u8 = 0x8, const S630: u8 = 0x1, const S631: u8 = 0x6,
    const S632: u8 = 0x1, const S633: u8 = 0x6, const S634: u8 = 0x4, const S635: u8 = 0xb,
    const S636: u8 = 0xb, const S637: u8 = 0xd, const S638: u8 = 0xd, const S639: u8 = 0x8,
    const S640: u8 = 0xc, const S641: u8 = 0x1, const S642: u8 = 0x3, const S643: u8 = 0x4,
    const S644: u8 = 0x7, const S645: u8 = 0xa, const S646: u8 = 0xe, const S647: u8 = 0x7,
    const S648: u8 = 0xa, const S649: u8 = 0x9, const S650: u8 = 0xf, const S651: u8 = 0x5,
    const S652: u8 = 0x6, const S653: u8 = 0x0, const S654: u8 = 0x8, const S655: u8 = 0xf,
    const S656: u8 = 0x0, const S657: u8 = 0xe, const S658: u8 = 0x5, const S659: u8 = 0x2,
    const S660: u8 = 0x9, const S661: u8 = 0x3, const S662: u8 = 0x2, const S663: u8 = 0xc,
    const S700: u8 = 0xd, const S701: u8 = 0x1, const S702: u8 = 0x2, const S703: u8 = 0xf,
    const S704: u8 = 0x8, const S705: u8 = 0xd, const S706: u8 = 0x4, const S707: u8 = 0x8,
    const S708: u8 = 0x6, const S709: u8 = 0xa, const S710: u8 = 0xf, const S711: u8 = 0x3,
    const S712: u8 = 0xb, const S713: u8 = 0x7, const S714: u8 = 0x1, const S715: u8 = 0x4,
    const S716: u8 = 0xa, const S717: u8 = 0xc, const S718: u8 = 0x9, const S719: u8 = 0x5,
    const S720: u8 = 0x3, const S721: u8 = 0x6, const S722: u8 = 0xe, const S723: u8 = 0xb,
    const S724: u8 = 0x5, const S725: u8 = 0x0, const S726: u8 = 0x0, const S727: u8 = 0xe,
    const S728: u8 = 0xc, const S729: u8 = 0x9, const S730: u8 = 0x7, const S731: u8 = 0x2,
    const S732: u8 = 0x7, const S733: u8 = 0x2, const S734: u8 = 0xb, const S735: u8 = 0x1,
    const S736: u8 = 0x4, const S737: u8 = 0xe, const S738: u8 = 0x1, const S739: u8 = 0x7,
    const S740: u8 = 0x9, const S741: u8 = 0x4, const S742: u8 = 0xc, const S743: u8 = 0xa,
    const S744: u8 = 0xe, const S745: u8 = 0x8, const S746: u8 = 0x2, const S747: u8 = 0xd,
    const S748: u8 = 0x0, const S749: u8 = 0xf, const S750: u8 = 0x6, const S751: u8 = 0xc,
    const S752: u8 = 0xa, const S753: u8 = 0x9, const S754: u8 = 0xd, const S755: u8 = 0x0,
    const S756: u8 = 0xf, const S757: u8 = 0x3, const S758: u8 = 0x3, const S759: u8 = 0x5,
    const S760: u8 = 0x5, const S761: u8 = 0x6, const S762: u8 = 0x8, const S763: u8 = 0xb>
            = DES_Generic<16, 0b_1000000100000011,
                    57, 49, 41, 33, 25, 17, 09, 01,
                    58, 50, 42, 34, 26, 18, 10, 02,
                    59, 51, 43, 35, 27, 19, 11, 03,
                    60, 52, 44, 36, 63, 55, 47, 39,
                    31, 23, 15, 07, 62, 54, 46, 38,
                    30, 22, 14, 06, 61, 53, 45, 37,
                    29, 21, 13, 05, 28, 20, 12, 04,
                    14, 17, 11, 24, 01, 05, 03, 28,
                    15, 06, 21, 10, 23, 19, 12, 04,
                    26, 08, 16, 07, 27, 20, 13, 02,
                    41, 52, 31, 37, 47, 55, 30, 40,
                    51, 45, 33, 48, 44, 49, 39, 56,
                    34, 53, 46, 42, 50, 36, 29, 32,
                    58, 50, 42, 34, 26, 18, 10, 02,
                    60, 52, 44, 36, 28, 20, 12, 04,
                    62, 54, 46, 38, 30, 22, 14, 06,
                    64, 56, 48, 40, 32, 24, 16, 08,
                    57, 49, 41, 33, 25, 17, 09, 01,
                    59, 51, 43, 35, 27, 19, 11, 03,
                    61, 53, 45, 37, 29, 21, 13, 05,
                    63, 55, 47, 39, 31, 23, 15, 07,
                    EP01, EP02, EP03, EP04, EP05, EP06, EP07, EP08, EP09, EP10, EP11, EP12,
                    EP13, EP14, EP15, EP16, EP17, EP18, EP19, EP20, EP21, EP22, EP23, EP24,
                    EP25, EP26, EP27, EP28, EP29, EP30, EP31, EP32, EP33, EP34, EP35, EP36,
                    EP37, EP38, EP39, EP40, EP41, EP42, EP43, EP44, EP45, EP46, EP47, EP48,
                    TP01, TP02, TP03, TP04, TP05, TP06, TP07, TP08, TP09, TP10, TP11, TP12,
                    TP13, TP14, TP15, TP16, TP17, TP18, TP19, TP20, TP21, TP22, TP23, TP24,
                    TP25, TP26, TP27, TP28, TP29, TP30, TP31, TP32,
                    S000, S001, S002, S003, S004, S005, S006, S007, S008, S009, S010, S011,
                    S012, S013, S014, S015, S016, S017, S018, S019, S020, S021, S022, S023,
                    S024, S025, S026, S027, S028, S029, S030, S031, S032, S033, S034, S035,
                    S036, S037, S038, S039, S040, S041, S042, S043, S044, S045, S046, S047,
                    S048, S049, S050, S051, S052, S053, S054, S055, S056, S057, S058, S059,
                    S060, S061, S062, S063,
                    S100, S101, S102, S103, S104, S105, S106, S107, S108, S109, S110, S111,
                    S112, S113, S114, S115, S116, S117, S118, S119, S120, S121, S122, S123,
                    S124, S125, S126, S127, S128, S129, S130, S131, S132, S133, S134, S135,
                    S136, S137, S138, S139, S140, S141, S142, S143, S144, S145, S146, S147,
                    S148, S149, S150, S151, S152, S153, S154, S155, S156, S157, S158, S159,
                    S160, S161, S162, S163,
                    S200, S201, S202, S203, S204, S205, S206, S207, S208, S209, S210, S211,
                    S212, S213, S214, S215, S216, S217, S218, S219, S220, S221, S222, S223,
                    S224, S225, S226, S227, S228, S229, S230, S231, S232, S233, S234, S235,
                    S236, S237, S238, S239, S240, S241, S242, S243, S244, S245, S246, S247,
                    S248, S249, S250, S251, S252, S253, S254, S255, S256, S257, S258, S259,
                    S260, S261, S262, S263,
                    S300, S301, S302, S303, S304, S305, S306, S307, S308, S309, S310, S311,
                    S312, S313, S314, S315, S316, S317, S318, S319, S320, S321, S322, S323,
                    S324, S325, S326, S327, S328, S329, S330, S331, S332, S333, S334, S335,
                    S336, S337, S338, S339, S340, S341, S342, S343, S344, S345, S346, S347,
                    S348, S349, S350, S351, S352, S353, S354, S355, S356, S357, S358, S359,
                    S360, S361, S362, S363,
                    S400, S401, S402, S403, S404, S405, S406, S407, S408, S409, S410, S411,
                    S412, S413, S414, S415, S416, S417, S418, S419, S420, S421, S422, S423,
                    S424, S425, S426, S427, S428, S429, S430, S431, S432, S433, S434, S435,
                    S436, S437, S438, S439, S440, S441, S442, S443, S444, S445, S446, S447,
                    S448, S449, S450, S451, S452, S453, S454, S455, S456, S457, S458, S459,
                    S460, S461, S462, S463,
                    S500, S501, S502, S503, S504, S505, S506, S507, S508, S509, S510, S511,
                    S512, S513, S514, S515, S516, S517, S518, S519, S520, S521, S522, S523,
                    S524, S525, S526, S527, S528, S529, S530, S531, S532, S533, S534, S535,
                    S536, S537, S538, S539, S540, S541, S542, S543, S544, S545, S546, S547,
                    S548, S549, S550, S551, S552, S553, S554, S555, S556, S557, S558, S559,
                    S560, S561, S562, S563,
                    S600, S601, S602, S603, S604, S605, S606, S607, S608, S609, S610, S611,
                    S612, S613, S614, S615, S616, S617, S618, S619, S620, S621, S622, S623,
                    S624, S625, S626, S627, S628, S629, S630, S631, S632, S633, S634, S635,
                    S636, S637, S638, S639, S640, S641, S642, S643, S644, S645, S646, S647,
                    S648, S649, S650, S651, S652, S653, S654, S655, S656, S657, S658, S659,
                    S660, S661, S662, S663,
                    S700, S701, S702, S703, S704, S705, S706, S707, S708, S709, S710, S711,
                    S712, S713, S714, S715, S716, S717, S718, S719, S720, S721, S722, S723,
                    S724, S725, S726, S727, S728, S729, S730, S731, S732, S733, S734, S735,
                    S736, S737, S738, S739, S740, S741, S742, S743, S744, S745, S746, S747,
                    S748, S749, S750, S751, S752, S753, S754, S755, S756, S757, S758, S759,
                    S760, S761, S762, S763>;




/// You have freedom of changing SHIFT, and PC101 ~ PC248.
/// You can change the DES algorithm by simply changing the generic parameters
/// `SHIFT`, and PC101 ~ PC248 without touching the source code itself.
/// - SHIFT: According to the number of rounds, you have to determine `SHIFT`
///   which is used for generating round keys. You can determine how many bits
///   the half keys will be rotated left for the corresponding round in the key
///   generator. If `SHIFT` is '0b10011001', the half keys will be rotated left
///   by one bit for the first round, and will be rotated left by two bits for
///   the second round, and will be rotated left by two bits for  the third round,
///   and so on. The LSB (Least Significant Bit) is for the first round and the
///   MSB (Most Significant Bit) is for the 128th round. `0` means that the half
///   keys will be rotated left by two bits and `1` means that the half keys
///   will be rotated left by one bit. Up to only `ROUND` bits from the LSB of
///   `SHIFT` will be meaningful. For example, if `ROUND` is 5 and `SHIFT` is
///   '0b10011001', only '0b11001' out of '0b10011001' is meaningful.
///   If `ROUND` is 16 and `SHIFT` is '0b10011001', `SHIFT` will be understood
///   to be '0b0000000010011001'.
/// - PC101 ~ PC248: Permutation compression. In key generator, the 64-bit key
///   which includes parity bits is compressed into 56-bit key by dropping all
///   the parity bits (8th, 16th, 24th, 32th, 40th, 48th, 56th, and 64th bits)
///   and permutating (or transposing or shuffling) all bits.  They are 1-based.
///   For this operation, PC101 ~ PC156 are used. You can change the permutation
///   compression algorithm by changing these parameters. Note that PC101 ~
///   PC248 should not include 8, 16, 24, 32, 40, 48, 56, and 64 because they
///   are all parity bits. If you include any of those numbers, the whole DES
///   encryption/decryption algorithm is broken or unstable or collapses. Also,
///   in key generator, 56-bit key is compressed into 48-bit key by dropping all
///   the bits (9th, 18th, 22nd, 25th, 35th, 43rd, and 54th bits) and
///   permutating (or transposing or shuffling) all bits. For this operation,
///   PC201 ~ PC248 are used. You can change the permutation compression
///   algorithm by changing these parameters. In this case, you can drop other
///   bits intead of dropping 9th, 18th, 22nd, 25th, 35th, 43rd, and 54th bits.
///   Dropping other bits does not kill the whole DES encryption/decryption
///   algorithm.
#[allow(non_camel_case_types)]
pub type DES_RoundKey<const SHIFT: u128 = 0b_1000000100000011,
const PC101: u8 = 57, const PC102: u8 = 49, const PC103: u8 = 41, const PC104: u8 = 33,
const PC105: u8 = 25, const PC106: u8 = 17, const PC107: u8 = 09, const PC108: u8 = 01,
const PC109: u8 = 58, const PC110: u8 = 50, const PC111: u8 = 42, const PC112: u8 = 34,
const PC113: u8 = 26, const PC114: u8 = 18, const PC115: u8 = 10, const PC116: u8 = 02,
const PC117: u8 = 59, const PC118: u8 = 51, const PC119: u8 = 43, const PC120: u8 = 35,
const PC121: u8 = 27, const PC122: u8 = 19, const PC123: u8 = 11, const PC124: u8 = 03,
const PC125: u8 = 60, const PC126: u8 = 52, const PC127: u8 = 44, const PC128: u8 = 36,
const PC129: u8 = 63, const PC130: u8 = 55, const PC131: u8 = 47, const PC132: u8 = 39,
const PC133: u8 = 31, const PC134: u8 = 23, const PC135: u8 = 15, const PC136: u8 = 07,
const PC137: u8 = 62, const PC138: u8 = 54, const PC139: u8 = 46, const PC140: u8 = 38,
const PC141: u8 = 30, const PC142: u8 = 22, const PC143: u8 = 14, const PC144: u8 = 06,
const PC145: u8 = 61, const PC146: u8 = 53, const PC147: u8 = 45, const PC148: u8 = 37,
const PC149: u8 = 29, const PC150: u8 = 21, const PC151: u8 = 13, const PC152: u8 = 05,
const PC153: u8 = 28, const PC154: u8 = 20, const PC155: u8 = 12, const PC156: u8 = 04,
const PC201: u8 = 14, const PC202: u8 = 17, const PC203: u8 = 11, const PC204: u8 = 24,
const PC205: u8 = 01, const PC206: u8 = 05, const PC207: u8 = 03, const PC208: u8 = 28,
const PC209: u8 = 15, const PC210: u8 = 06, const PC211: u8 = 21, const PC212: u8 = 10,
const PC213: u8 = 23, const PC214: u8 = 19, const PC215: u8 = 12, const PC216: u8 = 04,
const PC217: u8 = 26, const PC218: u8 = 08, const PC219: u8 = 16, const PC220: u8 = 07,
const PC221: u8 = 27, const PC222: u8 = 20, const PC223: u8 = 13, const PC224: u8 = 02,
const PC225: u8 = 41, const PC226: u8 = 52, const PC227: u8 = 31, const PC228: u8 = 37,
const PC229: u8 = 47, const PC230: u8 = 55, const PC231: u8 = 30, const PC232: u8 = 40,
const PC233: u8 = 51, const PC234: u8 = 45, const PC235: u8 = 33, const PC236: u8 = 48,
const PC237: u8 = 44, const PC238: u8 = 49, const PC239: u8 = 39, const PC240: u8 = 56,
const PC241: u8 = 34, const PC242: u8 = 53, const PC243: u8 = 46, const PC244: u8 = 42,
const PC245: u8 = 50, const PC246: u8 = 36, const PC247: u8 = 29, const PC248: u8 = 32>
            = DES_Generic<16, SHIFT,
                            PC101, PC102, PC103, PC104, PC105, PC106, PC107, PC108,
                            PC109, PC110, PC111, PC112, PC113, PC114, PC115, PC116,
                            PC117, PC118, PC119, PC120, PC121, PC122, PC123, PC124,
                            PC125, PC126, PC127, PC128, PC129, PC130, PC131, PC132,
                            PC133, PC134, PC135, PC136, PC137, PC138, PC139, PC140,
                            PC141, PC142, PC143, PC144, PC145, PC146, PC147, PC148,
                            PC149, PC150, PC151, PC152, PC153, PC154, PC155, PC156,
                            PC201, PC202, PC203, PC204, PC205, PC206, PC207, PC208,
                            PC209, PC210, PC211, PC212, PC213, PC214, PC215, PC216,
                            PC217, PC218, PC219, PC220, PC221, PC222, PC223, PC224,
                            PC225, PC226, PC227, PC228, PC229, PC230, PC231, PC232,
                            PC233, PC234, PC235, PC236, PC237, PC238, PC239, PC240,
                            PC241, PC242, PC243, PC244, PC245, PC246, PC247, PC248>;



/// You have freedom of changing ROUND and SHIFT. You can change the DES
/// algorithm by simply changing the generic parameters `ROUND` and `SHIFT`
/// without touching the source code itself.
/// - ROUND: You can determine how many times the Fiestel network will be
///   repeated. Its maximum value is 128 and its minimum value is 0.
///   Original DES has 16 rounds for its Feistel structure but you can increase
///   the number of rounds up to 128 rounds, and decrease it down to 0.
/// - SHIFT: According to the number of rounds, you have to determine `SHIFT`
///   which is used for generating round keys. You can determine how many bits
///   the half keys will be rotated left for the corresponding round in the key
///   generator. If `SHIFT` is '0b10011001', the half keys will be rotated left
///   by one bit for the first round, and will be rotated left by two bits for
///   the second round, and will be rotated left by two bits for  the third round,
///   and so on. The LSB (Least Significant Bit) is for the first round and the
///   MSB (Most Significant Bit) is for the 128th round. `0` means that the half
///   keys will be rotated left by two bits and `1` means that the half keys
///   will be rotated left by one bit. Up to only `ROUND` bits from the LSB of
///   `SHIFT` will be meaningful. For example, if `ROUND` is 5 and `SHIFT` is
///   '0b10011001', only '0b11001' out of '0b10011001' is meaningful.
///   If `ROUND` is 16 and `SHIFT` is '0b10011001', `SHIFT` will be understood
///   to be '0b0000000010011001'.
#[allow(non_camel_case_types)]
pub type DES_Expanded<const ROUND: usize = 16, const SHIFT: u128 = 0b_1000000100000011> = DES_Generic<ROUND, SHIFT>;

/// The official DES symmetric-key algorithm for the encryption of digital data
/// If you want to use the official DES algorithm, the type DES is for you.
#[allow(non_camel_case_types)]
pub type DES = DES_Generic;    // equivalent to `pub type DES = DES_Expanded;`

/// A DES symmetric-key algorithm for the encryption of digital data
/// 
/// # Note
/// **This descryption about DES is according to big endianness.**
/// MSB (Most Significant Bit) is the first bit and LSB (Least Significant Bit)
/// is the 64th bit in this descryption unless otherwise mentioned.
/// 
/// # Introduction
/// DES is the acronym of Data Encryption Standard. It is the symmetric key
/// encryption/decryption algorithm. It was originally developed based on
/// Lucifer encryption/decryption algorithm made by IBM. DES was approved as a 
/// federal standard in November 1976.
/// 
/// # Vulnerability
/// - Its key length is only 56-bit. It is considered to be too short against
///   modern computing power. Actually, in July, 1998, the DES key was broken by
///   brute-force attack within 56 hours with a machine DES cracker (Deep Crack)
///   made by EEF (Electronic Frontier Foundation). And, in January, 1999, Deep
///   Crack and distributed.net broke a DES key together within 22 hours and
///   15 minutes.
/// - Weak keys: 0x0000000000000000, 0x0101010101010101, 0xFFFFFFFFFFFFFFFF,
///   0xFEFEFEFEFEFEFEFE, 0xF1F1F1F1E0E0E0E0, 0xF0F0F0F0E1E1E1E1,
///   0x0E0E0E0E1F1F1F1F, 0x0F0F0F0F1E1E1E1E in little-endianness.
///   Actually, if the parity bits in keys are ignored,
///   the keys 0x0000000000000000 and 0x0101010101010101 are the same key.
///   In fact, not only 0x0101010101010101 is the same key as
///   0x0000000000000000. 0x0100000000000000 is also the same key. All the 256
///   keys that have only different parity bits and all other bits same are the
///   same key as 0x0000000000000000, too. Though only representative keys will
///   be mentioned in this description, please keep in mind that all the 256
///   keys that have only different parity bits and all other bits same are the
///   same key.
///   And, the keys 0xFFFFFFFFFFFFFFFF and 0xFEFEFEFEFEFEFEFE are also the same key.
///   And, The keys 0xF1F1F1F1E0E0E0E0 and 0xF0F0F0F0E1E1E1E1 are also the same key.
///   And, the keys 0x0E0E0E0E1F1F1F1F and 0x0F0F0F0F1E1E1E1E are the same key, too.
///   For instance, if you encrypt your data with the key 0x0000000000000000 and
///   encrypt the output ciphertext again with the same key 0x0000000000000000,
///   you will get the original plaintext! So, the ciphertext is only
///   secure-looking. 
/// - Semi-week keys: The pairs (0x0E010E011F011F01, 0x010E010E011F011F),
///   (0xF101F101E001E001, 0x01F101F101E001E0),
///   (0xFE01FE01FE01FE01, 0x01FE01FE01FE01FE),
///   (0xF10EF10EE01FE01F, 0x0EF10EF11FE01FE0),
///   (0xFE0EFE0EFE1FFE1F, 0x0EFE0EFE1FFE1FFE), and 
///   (0xFEF1FEF1FEE0FEE0, 0xF1FEF1FEE0FEE0FE) in little-endianness are
///   considered to be week.
///   For example, if you encrypt your data with the key 0x0E010E011F011F01 and
///   encrypt the output ciphertext again with its counterpart key
///   0x010E010E011F011F, you will get the original plaintext!
///   So, the ciphertext is only secure-looking.
/// 
/// # Examples for Weak keys
/// ```
/// use cryptocol::symmetric::DES;
/// let message = 0x1234567890ABCDEF_u64;
/// let mut cipher: u64;
/// let weak_key = [ 0x0000000000000000_u64, 0x0101010101010101, 0xFFFFFFFFFFFFFFFF, 0xFEFEFEFEFEFEFEFE, 0xF1F1F1F1E0E0E0E0, 0xF0F0F0F0E1E1E1E1, 0x0E0E0E0E1F1F1F1F, 0x0F0F0F0F1E1E1E1E];
/// let mut des = DES::new();
/// for key in weak_key
/// {
///     println!("Weak Key:\t{:#018X}", key);
///     des.set_key_u64(key);
///     cipher = des.encrypt_u64(message);
///     cipher = des.encrypt_u64(cipher);
/// 
///     println!("Message =\t{:#018X}", message);
///     println!("Cipher =\t{:#018X}", cipher);
///     assert_eq!(message, cipher);
///     println!();
/// }
/// ```
/// 
/// # Examples for Semi-Weak keys
/// ```
/// use cryptocol::symmetric::DES;
/// let message = 0x1234567890ABCDEF_u64;
/// let mut cipher: u64;
/// let semi_weak_key: [(u64, u64); 6] = [  (0x0E010E011F011F01, 0x010E010E011F011F),
///                                         (0xF101F101E001E001, 0x01F101F101E001E0),
///                                         (0xFE01FE01FE01FE01, 0x01FE01FE01FE01FE),
///                                         (0xF10EF10EE01FE01F, 0x0EF10EF11FE01FE0),
///                                         (0xFE0EFE0EFE1FFE1F, 0x0EFE0EFE1FFE1FFE),
///                                         (0xFEF1FEF1FEE0FEE0, 0xF1FEF1FEE0FEE0FE)];
/// let mut des = DES::new();
/// for key in semi_weak_key
/// {
///     println!("Semi-weak Key pair: {:#018X}, {:#018X}", key.0, key.1);
///     des.set_key_u64(key.0);
///     cipher = des.encrypt_u64(message);
///     des.set_key_u64(key.1);
///     cipher = des.encrypt_u64(cipher);
/// 
///     println!("Message =\t{:#018X}", message);
///     println!("Cipher =\t{:#018X}", cipher);
///     assert_eq!(message, cipher);
///     println!();
/// }
/// ```
/// 
/// # Use of DES and its variants
/// This algorithm is implemented generic way. Most of the constants are
/// implemented as generic constants. So, without changing any line of code, you
/// can change the algorithm by changing the generic parameter. You can design
/// and implement your own algorithm based on DES which uses Feistel structure.
/// 
/// # Generic Parameters
/// - ROUND: You can determine how many times the Fiestel network will be
///   repeated. Its maximum value is 128 and its minimum value is 0.
///   Original DES has 16 rounds for its Feistel structure but you can increase
///   the number of rounds up to 128 rounds, and decrease it down to 0.
/// - SHIFT: According to the number of rounds, you have to determine `SHIFT`
///   which is used for generating round keys. You can determine how many bits
///   the half keys will be rotated left for the corresponding round in the key
///   generator. If `SHIFT` is '0b10011001', the half keys will be rotated left
///   by one bit for the first round, and will be rotated left by two bits for
///   the second round, and will be rotated left by two bits for  the third round,
///   and so on. The LSB (Least Significant Bit) is for the first round and the
///   MSB (Most Significant Bit) is for the 128th round. `0` means that the half
///   keys will be rotated left by two bits and `1` means that the half keys
///   will be rotated left by one bit. Up to only `ROUND` bits from the LSB of
///   `SHIFT` will be meaningful. For example, if `ROUND` is 5 and `SHIFT` is
///   '0b10011001', only '0b11001' out of '0b10011001' is meaningful.
///   If `ROUND` is 16 and `SHIFT` is '0b10011001', `SHIFT` will be understood
///   to be '0b0000000010011001'.
/// - PC101 ~ PC248: Permutation compression. In key generator, the 64-bit key
///   which includes parity bits is compressed into 56-bit key by dropping all
///   the parity bits (8th, 16th, 24th, 32th, 40th, 48th, 56th, and 64th bits)
///   and permutating (or transposing or shuffling) all bits. They are 1-based.
///   For this operation, PC101 ~ PC156 are used. You can change the permutation
///   compression algorithm by changing these parameters. Note that PC101 ~
///   PC248 should not include 8, 16, 24, 32, 40, 48, 56, and 64 because they
///   are all parity bits. If you include any of those numbers, the whole DES
///   encryption/decryption algorithm is broken or unstable or collapses. Also,
///   in key generator, 56-bit key is compressed into 48-bit key by dropping all
///   the bits (9th, 18th, 22nd, 25th, 35th, 43rd, and 54th bits) and
///   permutating (or transposing or shuffling) all bits. For this operation,
///   PC201 ~ PC248 are used. You can change the permutation compression
///   algorithm by changing these parameters. In this case, you can drop other
///   bits intead of dropping 9th, 18th, 22nd, 25th, 35th, 43rd, and 54th bits.
///   Dropping other bits does not kill the whole DES encryption/decryption
///   algorithm.
/// - IP01 ~ IP64: Inital permutation constants. They are 1-based. For example,
///   `IP01 = 58` means that the 58th bit of data is moved to the first bit of
///   the data which is MSB at initial permutation. You can change inital
///   permutation wire by changing these constants. However, when you change
///   these constants, you have to remember that you should included all the
///   bits. You cannot drop any bit. Your dropping any bit will surely kill the
///   whole DES encryption/decryption algorithm. Final permutation constants is
///   automatically calculated from Inital permutation constants. FP01 ~ FP64
///   is inverse version of IP01 ~ IP64. So, FP01 ~ FP64 will be automagically
///   determined. You don't have to determine them.
/// - S000 ~ S763: S-Box constants. Its index such as 000, 212, etc. is
///   0-based. S0XX means S-Box 0, S1XX means S-Box 1, and so on. S000 is the
///   first element of S-Box 0.
///   According to [the document](https://page.math.tu-berlin.de/~kant/teaching/hess/krypto-ws2006/des.htm),
///   the input six bits determines the output of S-Box. The first and the last
///   bit of the six bits represent in base 2 a number in the decimal range 0 to
///   3 (or binary 00 to 11) which is row number. The rest middle four bits
///   represent in base 2 a number in the decimal range 0 to 15 (binary 0000 to
///   1111) which is column number. It is considered that the DES designers
///   explained the S-box structure _unnecessarily too complicated_. The
///   above-described S-box indexing way looks two dimensional, but actually is
///   one dimensional. So, in this crate, S-boxes are implemented to be
///   two-dimensional array which is an array of S-boxes. Each S-box is an array
///   of 64 four-bit numbers. The input six-bit number is used as the index of
///   the one-dimensional array of these 64 four-bit numbers. So, the S-box
///   tables have been rearranged to be the one-dimensional array. You can cange
///   S-Box by changing these constants. However, you have know that *the change
///   of these constants may hurt the security a lot*. And the principle of
///   S-box has been unknown so far.
/// - EP01 ~ EP48: Expansion permutation constants. They are 1-based. For
///   example, `EP01 = 28` means that the 28th bit of data is moved to the first
///   bit of the data which is MSB at expansion permutation. They expand the
///   32-bit right-half data from the Feistel structure of the corresponding
///   round into 48 bits in order to perform XOR (exclusive OR) with the
///   corresponding 48-bit round key. When you change these constants, you have
///   to remember that you should included all the bits. You cannot drop any
///   bit. Your dropping any bit will surely kill the whole DES
///   encryption/decryption algorithm.
/// - TP01 ~ TP32: Translation permutation constans.  They are 1-based. For
///   example, `TP01 = 16` means that the 16th bit of data is moved to the
///   first bit of the data which is MSB at translation permutation. You can
///   change translation permutation wire by changing these constants. However,
///   when you change these constants, you have to remember that you should
///   included all the bits. You cannot drop any bit. Your dropping any bit will
///   surely kill the whole DES encryption/decryption algorithm.
/// 
/// # Caution
/// DES is not considered to be secure anymore. So, it is wise not to use DES
/// for serious purpose. Instead, use TDES or AES or any other equivalents.
/// In this crate, NDES which is generalized version of TDES is provided, and
/// AES is also provided.
/// 
/// # Reference
/// [Read more](https://en.wikipedia.org/wiki/Data_Encryption_Standard)
/// about DES in brief.
/// Watch [this video](https://www.youtube.com/watch?v=kPBJIhpcZgE) and then
/// [this video](https://www.youtube.com/watch?v=l-7YW06BFNs) in series
/// for more (or deeper or full) understanding of DES.
/// 
/// # Quick Start
/// You have to import (use) the module `DES` in order to use official DES
/// as shown in Example 1.
/// 
/// # Example 1
/// ```
/// use cryptocol::symmetric::DES;
/// ```
/// 
/// You can instantiate the DES object with `u64` key as Example 2.
/// In this case, you have to take endianness into account.
/// In little-endianness, 0x_1234567890ABCDEF_u64 is [0xEFu8, 0xCDu8, 0xABu8,
/// 0x90u8, 0x78u8, 0x56u8, 0x34u8, 0x12u8] while the same 
/// 0x_1234567890ABCDEF_u64 is [0x12u8, 0x34u8, 0x56u8, 0x78u8, 0x90u8, 0xABu8,
/// 0xCDu8, 0xEF_u64] in big-endianness.
/// The instantiated object should be mutable.
/// 
/// # Example 2
/// ```
/// use cryptocol::symmetric::DES;
/// let key = 0x_1234567890ABCDEF_u64;
/// let mut _a_des = DES::new_with_key_u64(key);
/// ```
/// 
/// Also, you can instantiate the DES object with `[u8; 8]` key as shown in
/// Example 3. In this case, you don't have to take endianness into account.
/// The instantiated object should be mutable.
/// 
/// # Example 3
/// ```
/// use cryptocol::symmetric::DES;
/// let key = [0xEFu8, 0xCDu8, 0xABu8, 0x90u8, 0x78u8, 0x56u8, 0x34u8, 0x12u8];
/// let mut _a_des = DES::new_with_key(key);
/// ```
/// 
/// You can instantiate the DES object without key and set a `u64` key later as
/// shown in Example 4 or a `[u8; 8]` key later as shown in Example 5.
/// 
/// # Example 4
/// ```
/// use cryptocol::symmetric::DES;
/// let mut a_des = DES::new();
/// let key = 0x_1234567890ABCDEF_u64;
/// a_des.set_key_u64(key);
/// ```
/// 
/// # Example 5
/// ```
/// use cryptocol::symmetric::DES;
/// let mut a_des = DES::new();
/// let key = [0xEFu8, 0xCDu8, 0xABu8, 0x90u8, 0x78u8, 0x56u8, 0x34u8, 0x12u8];
/// a_des.set_key(key);
/// ```
/// 
/// Now, you can freely use any operation mode. This crate provide
/// ECB (Electronic CodeBook), CBC(Cipher Block Chaining), PCBC (Propagation
/// Cipher Block Chaining), CFB (Cipher FeedBack) OFB (Output FeedBack), and
/// CTR (CounTeR). You can choose the way of padding bits according to either
/// [PKCS #7](https://node-security.com/posts/cryptography-pkcs-7-padding/) or
/// [ISO 7816-4](https://en.wikipedia.org/wiki/Padding_(cryptography)#ISO/IEC_7816-4).
/// So, you can import (use) one of the following traits: ECB_PKCS7, ECB_ISO,
/// CBC_PKCS7, CBC_ISO, PCBC_PKCS7, PCBC_ISO, CFB, OFB, and CTR. The following
/// example 6 shows the case that you choose CBC operation mode and padding bits
/// according to PKCS #7.
/// 
/// # Example 6
/// ```
/// use std::io::Write;
/// use std::fmt::Write as _;
/// use cryptocol::symmetric::{ DES, CBC_PKCS7 };
/// 
/// let mut a_des = DES::new_with_key([0xEFu8, 0xCDu8, 0xABu8, 0x90u8, 0x78u8, 0x56u8, 0x34u8, 0x12u8]);
/// let message = "In the beginning God created the heavens and the earth.";
/// println!("M =\t{}", message);
/// let iv = 0x_FEDCBA0987654321_u64;
/// println!("IV =\t{}", iv);
/// let mut cipher = Vec::<u8>::new();
/// a_des.encrypt_str_into_vec(iv, message, &mut cipher);
/// print!("C =\t");
/// for c in cipher.clone()
///     { print!("{:02X} ", c); }
/// println!();
/// let mut txt = String::new();
/// for c in cipher.clone()
///     { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "4B B5 ED DC A0 58 7E 6D 6C 3B A2 00 38 C3 D4 29 42 B1 CF 0D E9 FA EA 11 11 6B C8 30 73 39 DD B7 3F 96 9B A3 76 05 34 7E 64 2F D4 CC B2 68 33 64 C5 9E EF 01 A9 4A FD 5B ");
/// 
/// let mut recovered = String::new();
/// a_des.decrypt_vec_into_string(iv, &cipher, &mut recovered);
/// println!("B (16 rounds) =\t{}", recovered);
/// assert_eq!(recovered, "In the beginning God created the heavens and the earth.");
/// assert_eq!(recovered, message);
/// println!();
/// ```
/// 
/// You can modify the DES encryption/decryption algorithm as you want. All
/// the constants are implemented as generic parameters. For instance, you can
/// change S-box, the number of rounds of Feistel network, the number of
/// shift-left in round key generators, etc. The following Example 7 shows the
/// variation of DES which has 128 rounds instead of 16 rounds.
/// 
/// # Example 7
/// ```
/// use std::io::Write;
/// use std::fmt::Write as _;
/// use cryptocol::symmetric::{ DES_Expanded, CBC_PKCS7 };
/// 
/// let mut a_des = DES_Expanded::<128, 0x_8103_8103_8103_8103_8103_8103_8103_8103_u128>::new_with_key_u64([0xEFu8, 0xCDu8, 0xABu8, 0x90u8, 0x78u8, 0x56u8, 0x34u8, 0x12u8]);
/// let message = "In the beginning God created the heavens and the earth.";
/// println!("M =\t{}", message);
/// let iv = 0x_FEDCBA0987654321_u64;
/// println!("IV =\t{}", iv);
/// let mut cipher = Vec::<u8>::new();
/// a_des.encrypt_str_into_vec(iv, message.as_ptr(), message.len() as u64, &mut cipher);
/// print!("C =\t");
/// for c in cipher.clone()
///     { print!("{:02X} ", c); }
/// println!();
/// let mut txt = String::new();
/// for c in cipher.clone()
///     { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "0B EA 6B BC 68 F9 B0 3E 7D AF DE 71 9C 08 AA 16 42 40 1C C8 DC 40 51 C6 8D D4 E7 D2 0B A4 F2 09 02 02 C2 6E 99 BC 9E 2A F4 11 7E 48 A7 ED 76 70 C6 9D C6 BD A6 9B 58 8B ");
/// 
/// let mut recovered = String::new();
/// a_des.decrypt_vec_into_string(iv, &cipher, &mut recovered);
/// println!("B =\t{}", recovered);
/// assert_eq!(recovered, "In the beginning God created the heavens and the earth.");
/// assert_eq!(recovered, message);
/// ```
/// 
/// # Notice for Practical Use
/// Now, you can freely use any methods with any paddings
/// in any operation modes.
/// - This crate provides six operation modes:
///   ECB, CBC, PCBC, CFB, OFB, and CTR.
/// - This crate provides two padding ways: ISO 7816-4 and PKCS #7.
/// - The operation modes ECB, CBC and PCBC requires padding bytes.
/// - You can combine three operation modes and two padding ways.
/// - The operation modes
///   [`CFB`](./trait.CFB.html#trait.CFB),
///   [`OFB`](./trait.OFB.html#trait.OFB), and
///   [`CTR`](./trait.CTR.html#trait.CTR)
///   does not require padding bytes.
/// - The traits that implements combination of operation modes and padding
///   ways are provided such as
///   [`ECB_PKCS7`](./trait.ECB_PKCS7.html#trait.ECB_PKCS7),
///   [`ECB_ISO`](./trait.ECB_ISO.html#trait.ECB_ISO),
///   [`CBC_PKCS7`](./trait.CBC_PKCS7.html#trait.ECB_PKCS7),
///   [`CBC_ISO`](./trait.CBC_ISO.html#trait.CBC_ISO),
///   [`PCBC_PKCS7`](./trait.PCBC_PKCS7.html#trait.PCBC_PKCS7), and
///   [`PCBC_ISO`](./trait.PCBC_ISO.html#trait.PCBC_ISO).
/// - You can find detaild instructions and their helpful examples
///   if you go through those links.
///
/// In summary,
///
/// |      | padding PKCS7                                          | padding ISO                                      | no padding                        |
/// |------|--------------------------------------------------------|--------------------------------------------------|-----------------------------------|
/// | ECB  | [ECB_PKCS7](./trait.ECB_PKCS7.html#trait.ECB_PKCS7)    | [ECB_ISO](./trait.ECB_ISO.html#trait.ECB_ISO)    |                                   |
/// | CBC  | [CBC_PKCS7](./trait.CBC_PKCS7.html#trait.ECB_PKCS7)    | [CBC_ISO](./trait.CBC_ISO.html#trait.CBC_ISO)    |                                   |
/// | PCBC | [PCBC_PKCS7](./trait.PCBC_PKCS7.html#trait.PCBC_PKCS7) | [PCBC_ISO](./trait.PCBC_ISO.html#trait.PCBC_ISO) |                                   |
/// | CFB  |                                                        |                                                  | [CFB](./trait.CFB.html#trait.CFB) |
/// | OFB  |                                                        |                                                  | [OFB](./trait.OFB.html#trait.OFB) |
/// | CTR  |                                                        |                                                  | [CTR](./trait.CTR.html#trait.CTR) |
///
#[allow(non_camel_case_types)]
#[derive(Clone)]
pub struct DES_Generic<const ROUND: usize = 16, const SHIFT: u128 = 0b_1000000100000011,
                const PC101: u8 = 57, const PC102: u8 = 49, const PC103: u8 = 41, const PC104: u8 = 33,
                const PC105: u8 = 25, const PC106: u8 = 17, const PC107: u8 = 09, const PC108: u8 = 01,
                const PC109: u8 = 58, const PC110: u8 = 50, const PC111: u8 = 42, const PC112: u8 = 34,
                const PC113: u8 = 26, const PC114: u8 = 18, const PC115: u8 = 10, const PC116: u8 = 02,
                const PC117: u8 = 59, const PC118: u8 = 51, const PC119: u8 = 43, const PC120: u8 = 35,
                const PC121: u8 = 27, const PC122: u8 = 19, const PC123: u8 = 11, const PC124: u8 = 03,
                const PC125: u8 = 60, const PC126: u8 = 52, const PC127: u8 = 44, const PC128: u8 = 36,
                const PC129: u8 = 63, const PC130: u8 = 55, const PC131: u8 = 47, const PC132: u8 = 39,
                const PC133: u8 = 31, const PC134: u8 = 23, const PC135: u8 = 15, const PC136: u8 = 07,
                const PC137: u8 = 62, const PC138: u8 = 54, const PC139: u8 = 46, const PC140: u8 = 38,
                const PC141: u8 = 30, const PC142: u8 = 22, const PC143: u8 = 14, const PC144: u8 = 06,
                const PC145: u8 = 61, const PC146: u8 = 53, const PC147: u8 = 45, const PC148: u8 = 37,
                const PC149: u8 = 29, const PC150: u8 = 21, const PC151: u8 = 13, const PC152: u8 = 05,
                const PC153: u8 = 28, const PC154: u8 = 20, const PC155: u8 = 12, const PC156: u8 = 04,
                const PC201: u8 = 14, const PC202: u8 = 17, const PC203: u8 = 11, const PC204: u8 = 24,
                const PC205: u8 = 01, const PC206: u8 = 05, const PC207: u8 = 03, const PC208: u8 = 28,
                const PC209: u8 = 15, const PC210: u8 = 06, const PC211: u8 = 21, const PC212: u8 = 10,
                const PC213: u8 = 23, const PC214: u8 = 19, const PC215: u8 = 12, const PC216: u8 = 04,
                const PC217: u8 = 26, const PC218: u8 = 08, const PC219: u8 = 16, const PC220: u8 = 07,
                const PC221: u8 = 27, const PC222: u8 = 20, const PC223: u8 = 13, const PC224: u8 = 02,
                const PC225: u8 = 41, const PC226: u8 = 52, const PC227: u8 = 31, const PC228: u8 = 37,
                const PC229: u8 = 47, const PC230: u8 = 55, const PC231: u8 = 30, const PC232: u8 = 40,
                const PC233: u8 = 51, const PC234: u8 = 45, const PC235: u8 = 33, const PC236: u8 = 48,
                const PC237: u8 = 44, const PC238: u8 = 49, const PC239: u8 = 39, const PC240: u8 = 56,
                const PC241: u8 = 34, const PC242: u8 = 53, const PC243: u8 = 46, const PC244: u8 = 42,
                const PC245: u8 = 50, const PC246: u8 = 36, const PC247: u8 = 29, const PC248: u8 = 32,
                const IP01: u8 = 58, const IP02: u8 = 50, const IP03: u8 = 42, const IP04: u8 = 34,
                const IP05: u8 = 26, const IP06: u8 = 18, const IP07: u8 = 10, const IP08: u8 = 02,
                const IP09: u8 = 60, const IP10: u8 = 52, const IP11: u8 = 44, const IP12: u8 = 36,
                const IP13: u8 = 28, const IP14: u8 = 20, const IP15: u8 = 12, const IP16: u8 = 04,
                const IP17: u8 = 62, const IP18: u8 = 54, const IP19: u8 = 46, const IP20: u8 = 38,
                const IP21: u8 = 30, const IP22: u8 = 22, const IP23: u8 = 14, const IP24: u8 = 06,
                const IP25: u8 = 64, const IP26: u8 = 56, const IP27: u8 = 48, const IP28: u8 = 40,
                const IP29: u8 = 32, const IP30: u8 = 24, const IP31: u8 = 16, const IP32: u8 = 08,
                const IP33: u8 = 57, const IP34: u8 = 49, const IP35: u8 = 41, const IP36: u8 = 33,
                const IP37: u8 = 25, const IP38: u8 = 17, const IP39: u8 = 09, const IP40: u8 = 01,
                const IP41: u8 = 59, const IP42: u8 = 51, const IP43: u8 = 43, const IP44: u8 = 35,
                const IP45: u8 = 27, const IP46: u8 = 19, const IP47: u8 = 11, const IP48: u8 = 03,
                const IP49: u8 = 61, const IP50: u8 = 53, const IP51: u8 = 45, const IP52: u8 = 37,
                const IP53: u8 = 29, const IP54: u8 = 21, const IP55: u8 = 13, const IP56: u8 = 05,
                const IP57: u8 = 63, const IP58: u8 = 55, const IP59: u8 = 47, const IP60: u8 = 39,
                const IP61: u8 = 31, const IP62: u8 = 23, const IP63: u8 = 15, const IP64: u8 = 07,
                const EP01: u8 = 32, const EP02: u8 = 01, const EP03: u8 = 02, const EP04: u8 = 03,
                const EP05: u8 = 04, const EP06: u8 = 05, const EP07: u8 = 04, const EP08: u8 = 05,
                const EP09: u8 = 06, const EP10: u8 = 07, const EP11: u8 = 08, const EP12: u8 = 09,
                const EP13: u8 = 08, const EP14: u8 = 09, const EP15: u8 = 10, const EP16: u8 = 11,
                const EP17: u8 = 12, const EP18: u8 = 13, const EP19: u8 = 12, const EP20: u8 = 13,
                const EP21: u8 = 14, const EP22: u8 = 15, const EP23: u8 = 16, const EP24: u8 = 17,
                const EP25: u8 = 16, const EP26: u8 = 17, const EP27: u8 = 18, const EP28: u8 = 19,
                const EP29: u8 = 20, const EP30: u8 = 21, const EP31: u8 = 20, const EP32: u8 = 21,
                const EP33: u8 = 22, const EP34: u8 = 23, const EP35: u8 = 24, const EP36: u8 = 25,
                const EP37: u8 = 24, const EP38: u8 = 25, const EP39: u8 = 26, const EP40: u8 = 27,
                const EP41: u8 = 28, const EP42: u8 = 29, const EP43: u8 = 28, const EP44: u8 = 29,
                const EP45: u8 = 30, const EP46: u8 = 31, const EP47: u8 = 32, const EP48: u8 = 01,
                const TP01: u8 = 16, const TP02: u8 = 07, const TP03: u8 = 20, const TP04: u8 = 21,
                const TP05: u8 = 29, const TP06: u8 = 12, const TP07: u8 = 28, const TP08: u8 = 17,
                const TP09: u8 = 01, const TP10: u8 = 15, const TP11: u8 = 23, const TP12: u8 = 26,
                const TP13: u8 = 05, const TP14: u8 = 18, const TP15: u8 = 31, const TP16: u8 = 10,
                const TP17: u8 = 02, const TP18: u8 = 08, const TP19: u8 = 24, const TP20: u8 = 14,
                const TP21: u8 = 32, const TP22: u8 = 27, const TP23: u8 = 03, const TP24: u8 = 09,
                const TP25: u8 = 19, const TP26: u8 = 13, const TP27: u8 = 30, const TP28: u8 = 06,
                const TP29: u8 = 22, const TP30: u8 = 11, const TP31: u8 = 04, const TP32: u8 = 25,
                const S000: u8 = 0xe, const S001: u8 = 0x0, const S002: u8 = 0x4, const S003: u8 = 0xf,
                const S004: u8 = 0xd, const S005: u8 = 0x7, const S006: u8 = 0x1, const S007: u8 = 0x4,
                const S008: u8 = 0x2, const S009: u8 = 0xe, const S010: u8 = 0xf, const S011: u8 = 0x2,
                const S012: u8 = 0xb, const S013: u8 = 0xd, const S014: u8 = 0x8, const S015: u8 = 0x1,
                const S016: u8 = 0x3, const S017: u8 = 0xa, const S018: u8 = 0xa, const S019: u8 = 0x6,
                const S020: u8 = 0x6, const S021: u8 = 0xc, const S022: u8 = 0xc, const S023: u8 = 0xb,
                const S024: u8 = 0x5, const S025: u8 = 0x9, const S026: u8 = 0x9, const S027: u8 = 0x5,
                const S028: u8 = 0x0, const S029: u8 = 0x3, const S030: u8 = 0x7, const S031: u8 = 0x8,
                const S032: u8 = 0x4, const S033: u8 = 0xf, const S034: u8 = 0x1, const S035: u8 = 0xc,
                const S036: u8 = 0xe, const S037: u8 = 0x8, const S038: u8 = 0x8, const S039: u8 = 0x2,
                const S040: u8 = 0xd, const S041: u8 = 0x4, const S042: u8 = 0x6, const S043: u8 = 0x9,
                const S044: u8 = 0x2, const S045: u8 = 0x1, const S046: u8 = 0xb, const S047: u8 = 0x7,
                const S048: u8 = 0xf, const S049: u8 = 0x5, const S050: u8 = 0xc, const S051: u8 = 0xb,
                const S052: u8 = 0x9, const S053: u8 = 0x3, const S054: u8 = 0x7, const S055: u8 = 0xe,
                const S056: u8 = 0x3, const S057: u8 = 0xa, const S058: u8 = 0xa, const S059: u8 = 0x0,
                const S060: u8 = 0x5, const S061: u8 = 0x6, const S062: u8 = 0x0, const S063: u8 = 0xd,
                const S100: u8 = 0xf, const S101: u8 = 0x3, const S102: u8 = 0x1, const S103: u8 = 0xd,
                const S104: u8 = 0x8, const S105: u8 = 0x4, const S106: u8 = 0xe, const S107: u8 = 0x7,
                const S108: u8 = 0x6, const S109: u8 = 0xf, const S110: u8 = 0xb, const S111: u8 = 0x2,
                const S112: u8 = 0x3, const S113: u8 = 0x8, const S114: u8 = 0x4, const S115: u8 = 0xe,
                const S116: u8 = 0x9, const S117: u8 = 0xc, const S118: u8 = 0x7, const S119: u8 = 0x0,
                const S120: u8 = 0x2, const S121: u8 = 0x1, const S122: u8 = 0xd, const S123: u8 = 0xa,
                const S124: u8 = 0xc, const S125: u8 = 0x6, const S126: u8 = 0x0, const S127: u8 = 0x9,
                const S128: u8 = 0x5, const S129: u8 = 0xb, const S130: u8 = 0xa, const S131: u8 = 0x5,
                const S132: u8 = 0x0, const S133: u8 = 0xd, const S134: u8 = 0xe, const S135: u8 = 0x8,
                const S136: u8 = 0x7, const S137: u8 = 0xa, const S138: u8 = 0xb, const S139: u8 = 0x1,
                const S140: u8 = 0xa, const S141: u8 = 0x3, const S142: u8 = 0x4, const S143: u8 = 0xf,
                const S144: u8 = 0xd, const S145: u8 = 0x4, const S146: u8 = 0x1, const S147: u8 = 0x2,
                const S148: u8 = 0x5, const S149: u8 = 0xb, const S150: u8 = 0x8, const S151: u8 = 0x6,
                const S152: u8 = 0xc, const S153: u8 = 0x7, const S154: u8 = 0x6, const S155: u8 = 0xc,
                const S156: u8 = 0x9, const S157: u8 = 0x0, const S158: u8 = 0x3, const S159: u8 = 0x5,
                const S160: u8 = 0x2, const S161: u8 = 0xe, const S162: u8 = 0xf, const S163: u8 = 0x9,
                const S200: u8 = 0xa, const S201: u8 = 0xd, const S202: u8 = 0x0, const S203: u8 = 0x7,
                const S204: u8 = 0x9, const S205: u8 = 0x0, const S206: u8 = 0xe, const S207: u8 = 0x9,
                const S208: u8 = 0x6, const S209: u8 = 0x3, const S210: u8 = 0x3, const S211: u8 = 0x4,
                const S212: u8 = 0xf, const S213: u8 = 0x6, const S214: u8 = 0x5, const S215: u8 = 0xa,
                const S216: u8 = 0x1, const S217: u8 = 0x2, const S218: u8 = 0xd, const S219: u8 = 0x8,
                const S220: u8 = 0xc, const S221: u8 = 0x5, const S222: u8 = 0x7, const S223: u8 = 0xe,
                const S224: u8 = 0xb, const S225: u8 = 0xc, const S226: u8 = 0x4, const S227: u8 = 0xb,
                const S228: u8 = 0x2, const S229: u8 = 0xf, const S230: u8 = 0x8, const S231: u8 = 0x1,
                const S232: u8 = 0xd, const S233: u8 = 0x1, const S234: u8 = 0x6, const S235: u8 = 0xa,
                const S236: u8 = 0x4, const S237: u8 = 0xd, const S238: u8 = 0x9, const S239: u8 = 0x0,
                const S240: u8 = 0x8, const S241: u8 = 0x6, const S242: u8 = 0xf, const S243: u8 = 0x9,
                const S244: u8 = 0x3, const S245: u8 = 0x8, const S246: u8 = 0x0, const S247: u8 = 0x7,
                const S248: u8 = 0xb, const S249: u8 = 0x4, const S250: u8 = 0x1, const S251: u8 = 0xf,
                const S252: u8 = 0x2, const S253: u8 = 0xe, const S254: u8 = 0xc, const S255: u8 = 0x3,
                const S256: u8 = 0x5, const S257: u8 = 0xb, const S258: u8 = 0xa, const S259: u8 = 0x5,
                const S260: u8 = 0xe, const S261: u8 = 0x2, const S262: u8 = 0x7, const S263: u8 = 0xc,
                const S300: u8 = 0x7, const S301: u8 = 0xd, const S302: u8 = 0xd, const S303: u8 = 0x8,
                const S304: u8 = 0xe, const S305: u8 = 0xb, const S306: u8 = 0x3, const S307: u8 = 0x5,
                const S308: u8 = 0x0, const S309: u8 = 0x6, const S310: u8 = 0x6, const S311: u8 = 0xf,
                const S312: u8 = 0x9, const S313: u8 = 0x0, const S314: u8 = 0xa, const S315: u8 = 0x3,
                const S316: u8 = 0x1, const S317: u8 = 0x4, const S318: u8 = 0x2, const S319: u8 = 0x7,
                const S320: u8 = 0x8, const S321: u8 = 0x2, const S322: u8 = 0x5, const S323: u8 = 0xc,
                const S324: u8 = 0xb, const S325: u8 = 0x1, const S326: u8 = 0xc, const S327: u8 = 0xa,
                const S328: u8 = 0x4, const S329: u8 = 0xe, const S330: u8 = 0xf, const S331: u8 = 0x9,
                const S332: u8 = 0xa, const S333: u8 = 0x3, const S334: u8 = 0x6, const S335: u8 = 0xf,
                const S336: u8 = 0x9, const S337: u8 = 0x0, const S338: u8 = 0x0, const S339: u8 = 0x6,
                const S340: u8 = 0xc, const S341: u8 = 0xa, const S342: u8 = 0xb, const S343: u8 = 0x1,
                const S344: u8 = 0x7, const S345: u8 = 0xd, const S346: u8 = 0xd, const S347: u8 = 0x8,
                const S348: u8 = 0xf, const S349: u8 = 0x9, const S350: u8 = 0x1, const S351: u8 = 0x4,
                const S352: u8 = 0x3, const S353: u8 = 0x5, const S354: u8 = 0xe, const S355: u8 = 0xb,
                const S356: u8 = 0x5, const S357: u8 = 0xc, const S358: u8 = 0x2, const S359: u8 = 0x7,
                const S360: u8 = 0x8, const S361: u8 = 0x2, const S362: u8 = 0x4, const S363: u8 = 0xe,
                const S400: u8 = 0x2, const S401: u8 = 0xe, const S402: u8 = 0xc, const S403: u8 = 0xb,
                const S404: u8 = 0x4, const S405: u8 = 0x2, const S406: u8 = 0x1, const S407: u8 = 0xc,
                const S408: u8 = 0x7, const S409: u8 = 0x4, const S410: u8 = 0xa, const S411: u8 = 0x7,
                const S412: u8 = 0xb, const S413: u8 = 0xd, const S414: u8 = 0x6, const S415: u8 = 0x1,
                const S416: u8 = 0x8, const S417: u8 = 0x5, const S418: u8 = 0x5, const S419: u8 = 0x0,
                const S420: u8 = 0x3, const S421: u8 = 0xf, const S422: u8 = 0xf, const S423: u8 = 0xa,
                const S424: u8 = 0xd, const S425: u8 = 0x3, const S426: u8 = 0x0, const S427: u8 = 0x9,
                const S428: u8 = 0xe, const S429: u8 = 0x8, const S430: u8 = 0x9, const S431: u8 = 0x6,
                const S432: u8 = 0x4, const S433: u8 = 0xb, const S434: u8 = 0x2, const S435: u8 = 0x8,
                const S436: u8 = 0x1, const S437: u8 = 0xc, const S438: u8 = 0xb, const S439: u8 = 0x7,
                const S440: u8 = 0xa, const S441: u8 = 0x1, const S442: u8 = 0xd, const S443: u8 = 0xe,
                const S444: u8 = 0x7, const S445: u8 = 0x2, const S446: u8 = 0x8, const S447: u8 = 0xd,
                const S448: u8 = 0xf, const S449: u8 = 0x6, const S450: u8 = 0x9, const S451: u8 = 0xf,
                const S452: u8 = 0xc, const S453: u8 = 0x0, const S454: u8 = 0x5, const S455: u8 = 0x9,
                const S456: u8 = 0x6, const S457: u8 = 0xa, const S458: u8 = 0x3, const S459: u8 = 0x4,
                const S460: u8 = 0x0, const S461: u8 = 0x5, const S462: u8 = 0xe, const S463: u8 = 0x3,
                const S500: u8 = 0xc, const S501: u8 = 0xa, const S502: u8 = 0x1, const S503: u8 = 0xf,
                const S504: u8 = 0xa, const S505: u8 = 0x4, const S506: u8 = 0xf, const S507: u8 = 0x2,
                const S508: u8 = 0x9, const S509: u8 = 0x7, const S510: u8 = 0x2, const S511: u8 = 0xc,
                const S512: u8 = 0x6, const S513: u8 = 0x9, const S514: u8 = 0x8, const S515: u8 = 0x5,
                const S516: u8 = 0x0, const S517: u8 = 0x6, const S518: u8 = 0xd, const S519: u8 = 0x1,
                const S520: u8 = 0x3, const S521: u8 = 0xd, const S522: u8 = 0x4, const S523: u8 = 0xe,
                const S524: u8 = 0xe, const S525: u8 = 0x0, const S526: u8 = 0x7, const S527: u8 = 0xb,
                const S528: u8 = 0x5, const S529: u8 = 0x3, const S530: u8 = 0xb, const S531: u8 = 0x8,
                const S532: u8 = 0x9, const S533: u8 = 0x4, const S534: u8 = 0xe, const S535: u8 = 0x3,
                const S536: u8 = 0xf, const S537: u8 = 0x2, const S538: u8 = 0x5, const S539: u8 = 0xc,
                const S540: u8 = 0x2, const S541: u8 = 0x9, const S542: u8 = 0x8, const S543: u8 = 0x5,
                const S544: u8 = 0xc, const S545: u8 = 0xf, const S546: u8 = 0x3, const S547: u8 = 0xa,
                const S548: u8 = 0x7, const S549: u8 = 0xb, const S550: u8 = 0x0, const S551: u8 = 0xe,
                const S552: u8 = 0x4, const S553: u8 = 0x1, const S554: u8 = 0xa, const S555: u8 = 0x7,
                const S556: u8 = 0x1, const S557: u8 = 0x6, const S558: u8 = 0xd, const S559: u8 = 0x0,
                const S560: u8 = 0xb, const S561: u8 = 0x8, const S562: u8 = 0x6, const S563: u8 = 0xd,
                const S600: u8 = 0x4, const S601: u8 = 0xd, const S602: u8 = 0xb, const S603: u8 = 0x0,
                const S604: u8 = 0x2, const S605: u8 = 0xb, const S606: u8 = 0xe, const S607: u8 = 0x7,
                const S608: u8 = 0xf, const S609: u8 = 0x4, const S610: u8 = 0x0, const S611: u8 = 0x9,
                const S612: u8 = 0x8, const S613: u8 = 0x1, const S614: u8 = 0xd, const S615: u8 = 0xa,
                const S616: u8 = 0x3, const S617: u8 = 0xe, const S618: u8 = 0xc, const S619: u8 = 0x3,
                const S620: u8 = 0x9, const S621: u8 = 0x5, const S622: u8 = 0x7, const S623: u8 = 0xc,
                const S624: u8 = 0x5, const S625: u8 = 0x2, const S626: u8 = 0xa, const S627: u8 = 0xf,
                const S628: u8 = 0x6, const S629: u8 = 0x8, const S630: u8 = 0x1, const S631: u8 = 0x6,
                const S632: u8 = 0x1, const S633: u8 = 0x6, const S634: u8 = 0x4, const S635: u8 = 0xb,
                const S636: u8 = 0xb, const S637: u8 = 0xd, const S638: u8 = 0xd, const S639: u8 = 0x8,
                const S640: u8 = 0xc, const S641: u8 = 0x1, const S642: u8 = 0x3, const S643: u8 = 0x4,
                const S644: u8 = 0x7, const S645: u8 = 0xa, const S646: u8 = 0xe, const S647: u8 = 0x7,
                const S648: u8 = 0xa, const S649: u8 = 0x9, const S650: u8 = 0xf, const S651: u8 = 0x5,
                const S652: u8 = 0x6, const S653: u8 = 0x0, const S654: u8 = 0x8, const S655: u8 = 0xf,
                const S656: u8 = 0x0, const S657: u8 = 0xe, const S658: u8 = 0x5, const S659: u8 = 0x2,
                const S660: u8 = 0x9, const S661: u8 = 0x3, const S662: u8 = 0x2, const S663: u8 = 0xc,
                const S700: u8 = 0xd, const S701: u8 = 0x1, const S702: u8 = 0x2, const S703: u8 = 0xf,
                const S704: u8 = 0x8, const S705: u8 = 0xd, const S706: u8 = 0x4, const S707: u8 = 0x8,
                const S708: u8 = 0x6, const S709: u8 = 0xa, const S710: u8 = 0xf, const S711: u8 = 0x3,
                const S712: u8 = 0xb, const S713: u8 = 0x7, const S714: u8 = 0x1, const S715: u8 = 0x4,
                const S716: u8 = 0xa, const S717: u8 = 0xc, const S718: u8 = 0x9, const S719: u8 = 0x5,
                const S720: u8 = 0x3, const S721: u8 = 0x6, const S722: u8 = 0xe, const S723: u8 = 0xb,
                const S724: u8 = 0x5, const S725: u8 = 0x0, const S726: u8 = 0x0, const S727: u8 = 0xe,
                const S728: u8 = 0xc, const S729: u8 = 0x9, const S730: u8 = 0x7, const S731: u8 = 0x2,
                const S732: u8 = 0x7, const S733: u8 = 0x2, const S734: u8 = 0xb, const S735: u8 = 0x1,
                const S736: u8 = 0x4, const S737: u8 = 0xe, const S738: u8 = 0x1, const S739: u8 = 0x7,
                const S740: u8 = 0x9, const S741: u8 = 0x4, const S742: u8 = 0xc, const S743: u8 = 0xa,
                const S744: u8 = 0xe, const S745: u8 = 0x8, const S746: u8 = 0x2, const S747: u8 = 0xd,
                const S748: u8 = 0x0, const S749: u8 = 0xf, const S750: u8 = 0x6, const S751: u8 = 0xc,
                const S752: u8 = 0xa, const S753: u8 = 0x9, const S754: u8 = 0xd, const S755: u8 = 0x0,
                const S756: u8 = 0xf, const S757: u8 = 0x3, const S758: u8 = 0x3, const S759: u8 = 0x5,
                const S760: u8 = 0x5, const S761: u8 = 0x6, const S762: u8 = 0x8, const S763: u8 = 0xb>
{
    key: LongUnion,
    block: LongUnion,
    round_key: [u64; ROUND],
    enc: fn (s: &mut Self, message: u64) -> u64,
    dec: fn (s: &mut Self, cipher: u64) -> u64,
}

impl <const ROUND: usize, const SHIFT: u128,
        const PC101: u8, const PC102: u8, const PC103: u8, const PC104: u8,
        const PC105: u8, const PC106: u8, const PC107: u8, const PC108: u8,
        const PC109: u8, const PC110: u8, const PC111: u8, const PC112: u8,
        const PC113: u8, const PC114: u8, const PC115: u8, const PC116: u8,
        const PC117: u8, const PC118: u8, const PC119: u8, const PC120: u8,
        const PC121: u8, const PC122: u8, const PC123: u8, const PC124: u8,
        const PC125: u8, const PC126: u8, const PC127: u8, const PC128: u8,
        const PC129: u8, const PC130: u8, const PC131: u8, const PC132: u8,
        const PC133: u8, const PC134: u8, const PC135: u8, const PC136: u8,
        const PC137: u8, const PC138: u8, const PC139: u8, const PC140: u8,
        const PC141: u8, const PC142: u8, const PC143: u8, const PC144: u8,
        const PC145: u8, const PC146: u8, const PC147: u8, const PC148: u8,
        const PC149: u8, const PC150: u8, const PC151: u8, const PC152: u8,
        const PC153: u8, const PC154: u8, const PC155: u8, const PC156: u8,
        const PC201: u8, const PC202: u8, const PC203: u8, const PC204: u8,
        const PC205: u8, const PC206: u8, const PC207: u8, const PC208: u8,
        const PC209: u8, const PC210: u8, const PC211: u8, const PC212: u8,
        const PC213: u8, const PC214: u8, const PC215: u8, const PC216: u8,
        const PC217: u8, const PC218: u8, const PC219: u8, const PC220: u8,
        const PC221: u8, const PC222: u8, const PC223: u8, const PC224: u8,
        const PC225: u8, const PC226: u8, const PC227: u8, const PC228: u8,
        const PC229: u8, const PC230: u8, const PC231: u8, const PC232: u8,
        const PC233: u8, const PC234: u8, const PC235: u8, const PC236: u8,
        const PC237: u8, const PC238: u8, const PC239: u8, const PC240: u8,
        const PC241: u8, const PC242: u8, const PC243: u8, const PC244: u8,
        const PC245: u8, const PC246: u8, const PC247: u8, const PC248: u8,
        const IP01: u8, const IP02: u8, const IP03: u8, const IP04: u8,
        const IP05: u8, const IP06: u8, const IP07: u8, const IP08: u8,
        const IP09: u8, const IP10: u8, const IP11: u8, const IP12: u8,
        const IP13: u8, const IP14: u8, const IP15: u8, const IP16: u8,
        const IP17: u8, const IP18: u8, const IP19: u8, const IP20: u8,
        const IP21: u8, const IP22: u8, const IP23: u8, const IP24: u8,
        const IP25: u8, const IP26: u8, const IP27: u8, const IP28: u8,
        const IP29: u8, const IP30: u8, const IP31: u8, const IP32: u8,
        const IP33: u8, const IP34: u8, const IP35: u8, const IP36: u8,
        const IP37: u8, const IP38: u8, const IP39: u8, const IP40: u8,
        const IP41: u8, const IP42: u8, const IP43: u8, const IP44: u8,
        const IP45: u8, const IP46: u8, const IP47: u8, const IP48: u8,
        const IP49: u8, const IP50: u8, const IP51: u8, const IP52: u8,
        const IP53: u8, const IP54: u8, const IP55: u8, const IP56: u8,
        const IP57: u8, const IP58: u8, const IP59: u8, const IP60: u8,
        const IP61: u8, const IP62: u8, const IP63: u8, const IP64: u8,
        const EP01: u8, const EP02: u8, const EP03: u8, const EP04: u8,
        const EP05: u8, const EP06: u8, const EP07: u8, const EP08: u8,
        const EP09: u8, const EP10: u8, const EP11: u8, const EP12: u8,
        const EP13: u8, const EP14: u8, const EP15: u8, const EP16: u8,
        const EP17: u8, const EP18: u8, const EP19: u8, const EP20: u8,
        const EP21: u8, const EP22: u8, const EP23: u8, const EP24: u8,
        const EP25: u8, const EP26: u8, const EP27: u8, const EP28: u8,
        const EP29: u8, const EP30: u8, const EP31: u8, const EP32: u8,
        const EP33: u8, const EP34: u8, const EP35: u8, const EP36: u8,
        const EP37: u8, const EP38: u8, const EP39: u8, const EP40: u8,
        const EP41: u8, const EP42: u8, const EP43: u8, const EP44: u8,
        const EP45: u8, const EP46: u8, const EP47: u8, const EP48: u8,
        const TP01: u8, const TP02: u8, const TP03: u8, const TP04: u8,
        const TP05: u8, const TP06: u8, const TP07: u8, const TP08: u8,
        const TP09: u8, const TP10: u8, const TP11: u8, const TP12: u8,
        const TP13: u8, const TP14: u8, const TP15: u8, const TP16: u8,
        const TP17: u8, const TP18: u8, const TP19: u8, const TP20: u8,
        const TP21: u8, const TP22: u8, const TP23: u8, const TP24: u8,
        const TP25: u8, const TP26: u8, const TP27: u8, const TP28: u8,
        const TP29: u8, const TP30: u8, const TP31: u8, const TP32: u8,
        const S000: u8, const S001: u8, const S002: u8, const S003: u8,
        const S004: u8, const S005: u8, const S006: u8, const S007: u8,
        const S008: u8, const S009: u8, const S010: u8, const S011: u8,
        const S012: u8, const S013: u8, const S014: u8, const S015: u8,
        const S016: u8, const S017: u8, const S018: u8, const S019: u8,
        const S020: u8, const S021: u8, const S022: u8, const S023: u8,
        const S024: u8, const S025: u8, const S026: u8, const S027: u8,
        const S028: u8, const S029: u8, const S030: u8, const S031: u8,
        const S032: u8, const S033: u8, const S034: u8, const S035: u8,
        const S036: u8, const S037: u8, const S038: u8, const S039: u8,
        const S040: u8, const S041: u8, const S042: u8, const S043: u8,
        const S044: u8, const S045: u8, const S046: u8, const S047: u8,
        const S048: u8, const S049: u8, const S050: u8, const S051: u8,
        const S052: u8, const S053: u8, const S054: u8, const S055: u8,
        const S056: u8, const S057: u8, const S058: u8, const S059: u8,
        const S060: u8, const S061: u8, const S062: u8, const S063: u8,
        const S100: u8, const S101: u8, const S102: u8, const S103: u8,
        const S104: u8, const S105: u8, const S106: u8, const S107: u8,
        const S108: u8, const S109: u8, const S110: u8, const S111: u8,
        const S112: u8, const S113: u8, const S114: u8, const S115: u8,
        const S116: u8, const S117: u8, const S118: u8, const S119: u8,
        const S120: u8, const S121: u8, const S122: u8, const S123: u8,
        const S124: u8, const S125: u8, const S126: u8, const S127: u8,
        const S128: u8, const S129: u8, const S130: u8, const S131: u8,
        const S132: u8, const S133: u8, const S134: u8, const S135: u8,
        const S136: u8, const S137: u8, const S138: u8, const S139: u8,
        const S140: u8, const S141: u8, const S142: u8, const S143: u8,
        const S144: u8, const S145: u8, const S146: u8, const S147: u8,
        const S148: u8, const S149: u8, const S150: u8, const S151: u8,
        const S152: u8, const S153: u8, const S154: u8, const S155: u8,
        const S156: u8, const S157: u8, const S158: u8, const S159: u8,
        const S160: u8, const S161: u8, const S162: u8, const S163: u8,
        const S200: u8, const S201: u8, const S202: u8, const S203: u8,
        const S204: u8, const S205: u8, const S206: u8, const S207: u8,
        const S208: u8, const S209: u8, const S210: u8, const S211: u8,
        const S212: u8, const S213: u8, const S214: u8, const S215: u8,
        const S216: u8, const S217: u8, const S218: u8, const S219: u8,
        const S220: u8, const S221: u8, const S222: u8, const S223: u8,
        const S224: u8, const S225: u8, const S226: u8, const S227: u8,
        const S228: u8, const S229: u8, const S230: u8, const S231: u8,
        const S232: u8, const S233: u8, const S234: u8, const S235: u8,
        const S236: u8, const S237: u8, const S238: u8, const S239: u8,
        const S240: u8, const S241: u8, const S242: u8, const S243: u8,
        const S244: u8, const S245: u8, const S246: u8, const S247: u8,
        const S248: u8, const S249: u8, const S250: u8, const S251: u8,
        const S252: u8, const S253: u8, const S254: u8, const S255: u8,
        const S256: u8, const S257: u8, const S258: u8, const S259: u8,
        const S260: u8, const S261: u8, const S262: u8, const S263: u8,
        const S300: u8, const S301: u8, const S302: u8, const S303: u8,
        const S304: u8, const S305: u8, const S306: u8, const S307: u8,
        const S308: u8, const S309: u8, const S310: u8, const S311: u8,
        const S312: u8, const S313: u8, const S314: u8, const S315: u8,
        const S316: u8, const S317: u8, const S318: u8, const S319: u8,
        const S320: u8, const S321: u8, const S322: u8, const S323: u8,
        const S324: u8, const S325: u8, const S326: u8, const S327: u8,
        const S328: u8, const S329: u8, const S330: u8, const S331: u8,
        const S332: u8, const S333: u8, const S334: u8, const S335: u8,
        const S336: u8, const S337: u8, const S338: u8, const S339: u8,
        const S340: u8, const S341: u8, const S342: u8, const S343: u8,
        const S344: u8, const S345: u8, const S346: u8, const S347: u8,
        const S348: u8, const S349: u8, const S350: u8, const S351: u8,
        const S352: u8, const S353: u8, const S354: u8, const S355: u8,
        const S356: u8, const S357: u8, const S358: u8, const S359: u8,
        const S360: u8, const S361: u8, const S362: u8, const S363: u8,
        const S400: u8, const S401: u8, const S402: u8, const S403: u8,
        const S404: u8, const S405: u8, const S406: u8, const S407: u8,
        const S408: u8, const S409: u8, const S410: u8, const S411: u8,
        const S412: u8, const S413: u8, const S414: u8, const S415: u8,
        const S416: u8, const S417: u8, const S418: u8, const S419: u8,
        const S420: u8, const S421: u8, const S422: u8, const S423: u8,
        const S424: u8, const S425: u8, const S426: u8, const S427: u8,
        const S428: u8, const S429: u8, const S430: u8, const S431: u8,
        const S432: u8, const S433: u8, const S434: u8, const S435: u8,
        const S436: u8, const S437: u8, const S438: u8, const S439: u8,
        const S440: u8, const S441: u8, const S442: u8, const S443: u8,
        const S444: u8, const S445: u8, const S446: u8, const S447: u8,
        const S448: u8, const S449: u8, const S450: u8, const S451: u8,
        const S452: u8, const S453: u8, const S454: u8, const S455: u8,
        const S456: u8, const S457: u8, const S458: u8, const S459: u8,
        const S460: u8, const S461: u8, const S462: u8, const S463: u8,
        const S500: u8, const S501: u8, const S502: u8, const S503: u8,
        const S504: u8, const S505: u8, const S506: u8, const S507: u8,
        const S508: u8, const S509: u8, const S510: u8, const S511: u8,
        const S512: u8, const S513: u8, const S514: u8, const S515: u8,
        const S516: u8, const S517: u8, const S518: u8, const S519: u8,
        const S520: u8, const S521: u8, const S522: u8, const S523: u8,
        const S524: u8, const S525: u8, const S526: u8, const S527: u8,
        const S528: u8, const S529: u8, const S530: u8, const S531: u8,
        const S532: u8, const S533: u8, const S534: u8, const S535: u8,
        const S536: u8, const S537: u8, const S538: u8, const S539: u8,
        const S540: u8, const S541: u8, const S542: u8, const S543: u8,
        const S544: u8, const S545: u8, const S546: u8, const S547: u8,
        const S548: u8, const S549: u8, const S550: u8, const S551: u8,
        const S552: u8, const S553: u8, const S554: u8, const S555: u8,
        const S556: u8, const S557: u8, const S558: u8, const S559: u8,
        const S560: u8, const S561: u8, const S562: u8, const S563: u8,
        const S600: u8, const S601: u8, const S602: u8, const S603: u8,
        const S604: u8, const S605: u8, const S606: u8, const S607: u8,
        const S608: u8, const S609: u8, const S610: u8, const S611: u8,
        const S612: u8, const S613: u8, const S614: u8, const S615: u8,
        const S616: u8, const S617: u8, const S618: u8, const S619: u8,
        const S620: u8, const S621: u8, const S622: u8, const S623: u8,
        const S624: u8, const S625: u8, const S626: u8, const S627: u8,
        const S628: u8, const S629: u8, const S630: u8, const S631: u8,
        const S632: u8, const S633: u8, const S634: u8, const S635: u8,
        const S636: u8, const S637: u8, const S638: u8, const S639: u8,
        const S640: u8, const S641: u8, const S642: u8, const S643: u8,
        const S644: u8, const S645: u8, const S646: u8, const S647: u8,
        const S648: u8, const S649: u8, const S650: u8, const S651: u8,
        const S652: u8, const S653: u8, const S654: u8, const S655: u8,
        const S656: u8, const S657: u8, const S658: u8, const S659: u8,
        const S660: u8, const S661: u8, const S662: u8, const S663: u8,
        const S700: u8, const S701: u8, const S702: u8, const S703: u8,
        const S704: u8, const S705: u8, const S706: u8, const S707: u8,
        const S708: u8, const S709: u8, const S710: u8, const S711: u8,
        const S712: u8, const S713: u8, const S714: u8, const S715: u8,
        const S716: u8, const S717: u8, const S718: u8, const S719: u8,
        const S720: u8, const S721: u8, const S722: u8, const S723: u8,
        const S724: u8, const S725: u8, const S726: u8, const S727: u8,
        const S728: u8, const S729: u8, const S730: u8, const S731: u8,
        const S732: u8, const S733: u8, const S734: u8, const S735: u8,
        const S736: u8, const S737: u8, const S738: u8, const S739: u8,
        const S740: u8, const S741: u8, const S742: u8, const S743: u8,
        const S744: u8, const S745: u8, const S746: u8, const S747: u8,
        const S748: u8, const S749: u8, const S750: u8, const S751: u8,
        const S752: u8, const S753: u8, const S754: u8, const S755: u8,
        const S756: u8, const S757: u8, const S758: u8, const S759: u8,
        const S760: u8, const S761: u8, const S762: u8, const S763: u8>
            DES_Generic<ROUND, SHIFT,
                        PC101, PC102, PC103, PC104, PC105, PC106, PC107, PC108,
                        PC109, PC110, PC111, PC112, PC113, PC114, PC115, PC116,
                        PC117, PC118, PC119, PC120, PC121, PC122, PC123, PC124,
                        PC125, PC126, PC127, PC128, PC129, PC130, PC131, PC132,
                        PC133, PC134, PC135, PC136, PC137, PC138, PC139, PC140,
                        PC141, PC142, PC143, PC144, PC145, PC146, PC147, PC148,
                        PC149, PC150, PC151, PC152, PC153, PC154, PC155, PC156,
                        PC201, PC202, PC203, PC204, PC205, PC206, PC207, PC208,
                        PC209, PC210, PC211, PC212, PC213, PC214, PC215, PC216,
                        PC217, PC218, PC219, PC220, PC221, PC222, PC223, PC224,
                        PC225, PC226, PC227, PC228, PC229, PC230, PC231, PC232,
                        PC233, PC234, PC235, PC236, PC237, PC238, PC239, PC240,
                        PC241, PC242, PC243, PC244, PC245, PC246, PC247, PC248,
                        IP01, IP02, IP03, IP04, IP05, IP06, IP07, IP08,
                        IP09, IP10, IP11, IP12, IP13, IP14, IP15, IP16,
                        IP17, IP18, IP19, IP20, IP21, IP22, IP23, IP24,
                        IP25, IP26, IP27, IP28, IP29, IP30, IP31, IP32,
                        IP33, IP34, IP35, IP36, IP37, IP38, IP39, IP40,
                        IP41, IP42, IP43, IP44, IP45, IP46, IP47, IP48,
                        IP49, IP50, IP51, IP52, IP53, IP54, IP55, IP56,
                        IP57, IP58, IP59, IP60, IP61, IP62, IP63, IP64,
                        EP01, EP02, EP03, EP04, EP05, EP06, EP07, EP08,
                        EP09, EP10, EP11, EP12, EP13, EP14, EP15, EP16,
                        EP17, EP18, EP19, EP20, EP21, EP22, EP23, EP24,
                        EP25, EP26, EP27, EP28, EP29, EP30, EP31, EP32,
                        EP33, EP34, EP35, EP36, EP37, EP38, EP39, EP40,
                        EP41, EP42, EP43, EP44, EP45, EP46, EP47, EP48,
                        TP01, TP02, TP03, TP04, TP05, TP06, TP07, TP08,
                        TP09, TP10, TP11, TP12, TP13, TP14, TP15, TP16,
                        TP17, TP18, TP19, TP20, TP21, TP22, TP23, TP24,
                        TP25, TP26, TP27, TP28, TP29, TP30, TP31, TP32,
                        S000, S001, S002, S003, S004, S005, S006, S007,
                        S008, S009, S010, S011, S012, S013, S014, S015,
                        S016, S017, S018, S019, S020, S021, S022, S023,
                        S024, S025, S026, S027, S028, S029, S030, S031,
                        S032, S033, S034, S035, S036, S037, S038, S039,
                        S040, S041, S042, S043, S044, S045, S046, S047,
                        S048, S049, S050, S051, S052, S053, S054, S055,
                        S056, S057, S058, S059, S060, S061, S062, S063,
                        S100, S101, S102, S103, S104, S105, S106, S107,
                        S108, S109, S110, S111, S112, S113, S114, S115,
                        S116, S117, S118, S119, S120, S121, S122, S123,
                        S124, S125, S126, S127, S128, S129, S130, S131,
                        S132, S133, S134, S135, S136, S137, S138, S139,
                        S140, S141, S142, S143, S144, S145, S146, S147,
                        S148, S149, S150, S151, S152, S153, S154, S155,
                        S156, S157, S158, S159, S160, S161, S162, S163,
                        S200, S201, S202, S203, S204, S205, S206, S207,
                        S208, S209, S210, S211, S212, S213, S214, S215,
                        S216, S217, S218, S219, S220, S221, S222, S223,
                        S224, S225, S226, S227, S228, S229, S230, S231,
                        S232, S233, S234, S235, S236, S237, S238, S239,
                        S240, S241, S242, S243, S244, S245, S246, S247,
                        S248, S249, S250, S251, S252, S253, S254, S255,
                        S256, S257, S258, S259, S260, S261, S262, S263,
                        S300, S301, S302, S303, S304, S305, S306, S307,
                        S308, S309, S310, S311, S312, S313, S314, S315,
                        S316, S317, S318, S319, S320, S321, S322, S323,
                        S324, S325, S326, S327, S328, S329, S330, S331,
                        S332, S333, S334, S335, S336, S337, S338, S339,
                        S340, S341, S342, S343, S344, S345, S346, S347,
                        S348, S349, S350, S351, S352, S353, S354, S355,
                        S356, S357, S358, S359, S360, S361, S362, S363,
                        S400, S401, S402, S403, S404, S405, S406, S407,
                        S408, S409, S410, S411, S412, S413, S414, S415,
                        S416, S417, S418, S419, S420, S421, S422, S423,
                        S424, S425, S426, S427, S428, S429, S430, S431,
                        S432, S433, S434, S435, S436, S437, S438, S439,
                        S440, S441, S442, S443, S444, S445, S446, S447,
                        S448, S449, S450, S451, S452, S453, S454, S455,
                        S456, S457, S458, S459, S460, S461, S462, S463,
                        S500, S501, S502, S503, S504, S505, S506, S507,
                        S508, S509, S510, S511, S512, S513, S514, S515,
                        S516, S517, S518, S519, S520, S521, S522, S523,
                        S524, S525, S526, S527, S528, S529, S530, S531,
                        S532, S533, S534, S535, S536, S537, S538, S539,
                        S540, S541, S542, S543, S544, S545, S546, S547,
                        S548, S549, S550, S551, S552, S553, S554, S555,
                        S556, S557, S558, S559, S560, S561, S562, S563,
                        S600, S601, S602, S603, S604, S605, S606, S607,
                        S608, S609, S610, S611, S612, S613, S614, S615,
                        S616, S617, S618, S619, S620, S621, S622, S623,
                        S624, S625, S626, S627, S628, S629, S630, S631,
                        S632, S633, S634, S635, S636, S637, S638, S639,
                        S640, S641, S642, S643, S644, S645, S646, S647,
                        S648, S649, S650, S651, S652, S653, S654, S655,
                        S656, S657, S658, S659, S660, S661, S662, S663,
                        S700, S701, S702, S703, S704, S705, S706, S707,
                        S708, S709, S710, S711, S712, S713, S714, S715,
                        S716, S717, S718, S719, S720, S721, S722, S723,
                        S724, S725, S726, S727, S728, S729, S730, S731,
                        S732, S733, S734, S735, S736, S737, S738, S739,
                        S740, S741, S742, S743, S744, S745, S746, S747,
                        S748, S749, S750, S751, S752, S753, S754, S755,
                        S756, S757, S758, S759, S760, S761, S762, S763>
{
    pub(super) const BLOCK_SIZE: usize = 8;

    const SBOX: [[u8; 64]; 8] = [
              [ S000, S001, S002, S003, S004, S005, S006, S007,
                S008, S009, S010, S011, S012, S013, S014, S015,
                S016, S017, S018, S019, S020, S021, S022, S023,
                S024, S025, S026, S027, S028, S029, S030, S031,
                S032, S033, S034, S035, S036, S037, S038, S039,
                S040, S041, S042, S043, S044, S045, S046, S047,
                S048, S049, S050, S051, S052, S053, S054, S055,
                S056, S057, S058, S059, S060, S061, S062, S063 ],
              [ S100, S101, S102, S103, S104, S105, S106, S107,
                S108, S109, S110, S111, S112, S113, S114, S115,
                S116, S117, S118, S119, S120, S121, S122, S123,
                S124, S125, S126, S127, S128, S129, S130, S131,
                S132, S133, S134, S135, S136, S137, S138, S139,
                S140, S141, S142, S143, S144, S145, S146, S147,
                S148, S149, S150, S151, S152, S153, S154, S155,
                S156, S157, S158, S159, S160, S161, S162, S163 ],
              [ S200, S201, S202, S203, S204, S205, S206, S207,
                S208, S209, S210, S211, S212, S213, S214, S215,
                S216, S217, S218, S219, S220, S221, S222, S223,
                S224, S225, S226, S227, S228, S229, S230, S231,
                S232, S233, S234, S235, S236, S237, S238, S239,
                S240, S241, S242, S243, S244, S245, S246, S247,
                S248, S249, S250, S251, S252, S253, S254, S255,
                S256, S257, S258, S259, S260, S261, S262, S263 ],
              [ S300, S301, S302, S303, S304, S305, S306, S307,
                S308, S309, S310, S311, S312, S313, S314, S315,
                S316, S317, S318, S319, S320, S321, S322, S323,
                S324, S325, S326, S327, S328, S329, S330, S331,
                S332, S333, S334, S335, S336, S337, S338, S339,
                S340, S341, S342, S343, S344, S345, S346, S347,
                S348, S349, S350, S351, S352, S353, S354, S355,
                S356, S357, S358, S359, S360, S361, S362, S363 ],
              [ S400, S401, S402, S403, S404, S405, S406, S407,
                S408, S409, S410, S411, S412, S413, S414, S415,
                S416, S417, S418, S419, S420, S421, S422, S423,
                S424, S425, S426, S427, S428, S429, S430, S431,
                S432, S433, S434, S435, S436, S437, S438, S439,
                S440, S441, S442, S443, S444, S445, S446, S447,
                S448, S449, S450, S451, S452, S453, S454, S455,
                S456, S457, S458, S459, S460, S461, S462, S463 ],
              [ S500, S501, S502, S503, S504, S505, S506, S507,
                S508, S509, S510, S511, S512, S513, S514, S515,
                S516, S517, S518, S519, S520, S521, S522, S523,
                S524, S525, S526, S527, S528, S529, S530, S531,
                S532, S533, S534, S535, S536, S537, S538, S539,
                S540, S541, S542, S543, S544, S545, S546, S547,
                S548, S549, S550, S551, S552, S553, S554, S555,
                S556, S557, S558, S559, S560, S561, S562, S563 ],
              [ S600, S601, S602, S603, S604, S605, S606, S607,
                S608, S609, S610, S611, S612, S613, S614, S615,
                S616, S617, S618, S619, S620, S621, S622, S623,
                S624, S625, S626, S627, S628, S629, S630, S631,
                S632, S633, S634, S635, S636, S637, S638, S639,
                S640, S641, S642, S643, S644, S645, S646, S647,
                S648, S649, S650, S651, S652, S653, S654, S655,
                S656, S657, S658, S659, S660, S661, S662, S663 ],
              [ S700, S701, S702, S703, S704, S705, S706, S707,
                S708, S709, S710, S711, S712, S713, S714, S715,
                S716, S717, S718, S719, S720, S721, S722, S723,
                S724, S725, S726, S727, S728, S729, S730, S731,
                S732, S733, S734, S735, S736, S737, S738, S739,
                S740, S741, S742, S743, S744, S745, S746, S747,
                S748, S749, S750, S751, S752, S753, S754, S755,
                S756, S757, S758, S759, S760, S761, S762, S763 ]
    ];

    // Initial Permutation Table changed to be 0-based in little endianness
    // So, LSB is 0-th bit and MSB is 63-rd bit in u64.
    const IP: [u8; 64] = [
            convert!(IP08), convert!(IP07), convert!(IP06), convert!(IP05),
            convert!(IP04), convert!(IP03), convert!(IP02), convert!(IP01),
            convert!(IP16), convert!(IP15), convert!(IP14), convert!(IP13),
            convert!(IP12), convert!(IP11), convert!(IP10), convert!(IP09),
            convert!(IP24), convert!(IP23), convert!(IP22), convert!(IP21),
            convert!(IP20), convert!(IP19), convert!(IP18), convert!(IP17),
            convert!(IP32), convert!(IP31), convert!(IP30), convert!(IP29),
            convert!(IP28), convert!(IP27), convert!(IP26), convert!(IP25),
            convert!(IP40), convert!(IP39), convert!(IP38), convert!(IP37),
            convert!(IP36), convert!(IP35), convert!(IP34), convert!(IP33),
            convert!(IP48), convert!(IP47), convert!(IP46), convert!(IP45),
            convert!(IP44), convert!(IP43), convert!(IP42), convert!(IP41),
            convert!(IP56), convert!(IP55), convert!(IP54), convert!(IP53),
            convert!(IP52), convert!(IP51), convert!(IP50), convert!(IP49),
            convert!(IP64), convert!(IP63), convert!(IP62), convert!(IP61),
            convert!(IP60), convert!(IP59), convert!(IP58), convert!(IP57)
    ];

    // Final Permutation Table changed to be 0-based in little endianness
    // So, LSB is 0-th bit and MSB is 63-rd bit in u64.
    const FP: [u8; 64] = make_FP!();

    // Expansion Permutation Table changed to be 0-based in little endianness
    // So, LSB is 0-th bit and MSB is 48-th bit in u48.
    const EP: [u8; 48] = [
        convert!(EP08), convert!(EP07), convert!(EP06), convert!(EP05),
        convert!(EP04), convert!(EP03), convert!(EP02), convert!(EP01),
        convert!(EP16), convert!(EP15), convert!(EP14), convert!(EP13),
        convert!(EP12), convert!(EP11), convert!(EP10), convert!(EP09),
        convert!(EP24), convert!(EP23), convert!(EP22), convert!(EP21),
        convert!(EP20), convert!(EP19), convert!(EP18), convert!(EP17),
        convert!(EP32), convert!(EP31), convert!(EP30), convert!(EP29),
        convert!(EP28), convert!(EP27), convert!(EP26), convert!(EP25),
        convert!(EP40), convert!(EP39), convert!(EP38), convert!(EP37),
        convert!(EP36), convert!(EP35), convert!(EP34), convert!(EP33),
        convert!(EP48), convert!(EP47), convert!(EP46), convert!(EP45),
        convert!(EP44), convert!(EP43), convert!(EP42), convert!(EP41)
    ];

    // Initial Permutation Table changed to be 0-based in little endianness
    // So, LSB is 0-th bit and MSB is 63-rd bit in u64.
    const TP: [u8; 32] = [
        convert!(TP08), convert!(TP07), convert!(TP06), convert!(TP05),
        convert!(TP04), convert!(TP03), convert!(TP02), convert!(TP01),
        convert!(TP16), convert!(TP15), convert!(TP14), convert!(TP13),
        convert!(TP12), convert!(TP11), convert!(TP10), convert!(TP09),
        convert!(TP24), convert!(TP23), convert!(TP22), convert!(TP21),
        convert!(TP20), convert!(TP19), convert!(TP18), convert!(TP17),
        convert!(TP32), convert!(TP31), convert!(TP30), convert!(TP29),
        convert!(TP28), convert!(TP27), convert!(TP26), convert!(TP25)
    ];

    const PC1: [u8; 56] = [
        convert!(PC108), convert!(PC107), convert!(PC106), convert!(PC105),
        convert!(PC104), convert!(PC103), convert!(PC102), convert!(PC101),
        convert!(PC116), convert!(PC115), convert!(PC114), convert!(PC113),
        convert!(PC112), convert!(PC111), convert!(PC110), convert!(PC109),
        convert!(PC124), convert!(PC123), convert!(PC122), convert!(PC121),
        convert!(PC120), convert!(PC119), convert!(PC118), convert!(PC117),
        convert!(PC132), convert!(PC131), convert!(PC130), convert!(PC129),
        convert!(PC128), convert!(PC127), convert!(PC126), convert!(PC125),
        convert!(PC140), convert!(PC139), convert!(PC138), convert!(PC137),
        convert!(PC136), convert!(PC135), convert!(PC134), convert!(PC133),
        convert!(PC148), convert!(PC147), convert!(PC146), convert!(PC145),
        convert!(PC144), convert!(PC143), convert!(PC142), convert!(PC141),
        convert!(PC156), convert!(PC155), convert!(PC154), convert!(PC153),
        convert!(PC152), convert!(PC151), convert!(PC150), convert!(PC149)
    ];

    const PC2: [u8; 48] = [
        convert!(PC208), convert!(PC207), convert!(PC206), convert!(PC205),
        convert!(PC204), convert!(PC203), convert!(PC202), convert!(PC201),
        convert!(PC216), convert!(PC215), convert!(PC214), convert!(PC213),
        convert!(PC212), convert!(PC211), convert!(PC210), convert!(PC209),
        convert!(PC224), convert!(PC223), convert!(PC222), convert!(PC221),
        convert!(PC220), convert!(PC219), convert!(PC218), convert!(PC217),
        convert!(PC232), convert!(PC231), convert!(PC230), convert!(PC229),
        convert!(PC228), convert!(PC227), convert!(PC226), convert!(PC225),
        convert!(PC240), convert!(PC239), convert!(PC238), convert!(PC237),
        convert!(PC236), convert!(PC235), convert!(PC234), convert!(PC233),
        convert!(PC248), convert!(PC247), convert!(PC246), convert!(PC245),
        convert!(PC244), convert!(PC243), convert!(PC242), convert!(PC241)
    ];

    const SUCCESS: u64 = !0;
    const FAILURE: u64 = 0;
    const MASK: u64 = 0xFEFEFEFEFEFEFEFE;

    // pub fn new() -> Self
    /// Constructs a new object DES_Generic.
    ///
    /// # Features
    /// - In order to encrypt data, object should be instantiated mutable.
    /// - This method sets the key to be [0_u8, 0, 0, 0, 0, 0, 0, 0].
    /// - Do not use this default key [0_u8, 0, 0, 0, 0, 0, 0, 0]
    ///   because it is known as one of the weak keys.
    ///
    /// # Example 1
    /// ```
    /// use cryptocol::symmetric::DES;
    ///
    /// let mut des = DES::new();   // The default key is 0x0000000000000000 which is a weak key.
    /// let plaintext = 0x1234567890ABCDEF_u64;
    /// let ciphertext = des.encrypt_u64(plaintext);
    ///
    /// println!("Plaintext:\t\t{:#018X}", plaintext);
    /// println!("Ciphertext:\t\t{:#018X}", ciphertext);
    /// assert_eq!(ciphertext, 0x1E32B46B44C69201_u64);
    ///
    /// let cipher_cipher_text = des.encrypt_u64(ciphertext);
    /// println!("Cipher-ciphertext:\t{:#018X}", cipher_cipher_text);
    /// assert_eq!(cipher_cipher_text, 0x1234567890ABCDEF_u64);
    /// assert_eq!(cipher_cipher_text, plaintext);  // So, you can't use the default key!!!
    /// ```
    ///
    /// # For more examples,
    /// click [here](./documentation/des_basic/struct.DES_Generic.html#method.new)
    #[inline]
    pub fn new() -> Self
    {
        Self::new_with_key([0_u8; 8])
    }

    // pub fn new_with_key(key: [u8; 8]) -> Self
    /// Constructs a new object DES_Generic.
    ///
    /// # Arguments
    /// - The argument `key` is the array of u8 that has 8 elements.
    /// - Remember that inverted parity bits do not affect the 56-bit real key.
    ///   So, [0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00],
    ///   [0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01],
    ///   [0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01],
    ///   [0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00],
    ///   [0x01, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01], etc.
    ///   are all the same keys. Each key has 255 different equivalent keys
    ///   in DES.
    ///
    /// # Features
    /// This method sets the key to be the given argument `key`.
    ///
    /// # Example 1 for normal case
    /// ```
    /// use cryptocol::symmetric::DES;
    /// let mut des = DES::new_with_key([0x12, 0x34, 0x56, 0x78, 0x90, 0xAB, 0xCD, 0xEF]);
    /// let plaintext = 0x1234567890ABCDEF_u64;
    /// let ciphertext = des.encrypt_u64(plaintext);
    ///
    /// println!("Plaintext:\t\t{:#018X}", plaintext);
    /// println!("Ciphertext:\t\t{:#018X}", ciphertext);
    /// assert_eq!(ciphertext, 0x3B6041D76AF28F23_u64);
    ///
    /// let cipher_cipher_text = des.encrypt_u64(ciphertext);
    /// println!("Cipher-ciphertext:\t{:#018X}\n", cipher_cipher_text);
    /// assert_eq!(cipher_cipher_text, 0x7C5AAE491DC1310D_u64);
    /// assert_ne!(cipher_cipher_text, plaintext);
    /// ```
    ///
    /// # For more examples,
    /// click [here](./documentation/des_basic/struct.DES_Generic.html#method.new_with_key)
    pub fn new_with_key(key: [u8; 8]) -> Self
    {
        let mut des = Self
        {
            key:        LongUnion::new_with_ubytes(key),
            block:      LongUnion::new(),
            round_key:  [0_u64; ROUND],
            enc:        Self::encrypt_u64,
            dec:        Self::decrypt_u64,
        };
        des.make_round_keys();
        des
    }

    // pub fn new_with_key_u64(key: u64) -> Self
    /// Constructs a new object DES_Generic.
    ///
    /// # Arguments
    /// - The argument `key` is of `u64`.
    /// - It should be in the same endianness of machine. For example,
    ///   if the intended key is [0x12, 0x34, 0x56, 0x78, 0x90, 0xAB, 0xCD,
    ///   0xEF], the key in `u64` for this argument is 0x_1234567890ABCDEF_u64
    ///   for big-endian machine, and the key in `u64` for this argument is
    ///   0x_EFCDAB9078563412_u64 for little-endian machine.
    /// - Remember that inverted parity bits do not affect the 56-bit real key.
    ///   So, 0x_0000_0000_0000_0000_u4, 0x_0101_0101_0101_0101_u64,
    ///   0x_0000_0000_0000_0001_u64, 0x_0000_0000_0000_0100_u64,
    ///   0x_0100_0010_0000_0001_u64, etc. are all the same keys.
    ///   Each key has 255 different equivalent keys in DES.
    ///
    /// # Features
    /// This method sets the key to be the given argument `key`.
    ///
    /// # Example 1 for normal case
    /// ```
    /// use cryptocol::symmetric::DES;
    ///
    /// let mut des = DES::new_with_key_u64(0xEFCDAB9078563412);
    /// let plaintext = 0x1234567890ABCDEF_u64;
    /// let ciphertext = des.encrypt_u64(plaintext);
    ///
    /// println!("Plaintext:\t\t{:#018X}", plaintext);
    /// println!("Ciphertext:\t\t{:#018X}", ciphertext);
    /// assert_eq!(ciphertext, 0x3B6041D76AF28F23_u64);
    ///
    /// let cipher_cipher_text = des.encrypt_u64(ciphertext);
    /// println!("Cipher-ciphertext:\t{:#018X}\n", cipher_cipher_text);
    /// assert_eq!(cipher_cipher_text, 0x7C5AAE491DC1310D_u64);
    /// assert_ne!(cipher_cipher_text, plaintext);
    /// ```
    ///
    /// # For more examples,
    /// click [here](./documentation/des_basic/struct.DES_Generic.html#method.new_with_key_u64)
    pub fn new_with_key_u64(key: u64) -> Self
    {
        let mut des = Self
        {
            key:        LongUnion::new_with(key),
            block:      LongUnion::new(),
            round_key:  [0_u64; ROUND],
            enc:        Self::encrypt_u64,
            dec:        Self::decrypt_u64,
        };
        des.make_round_keys();
        des
    }

    // pub fn encryptor_with_key(key: [u8; 8]) -> Self
    /// Constructs a new object DES_Generic as a positive encryptor (or
    /// an encryptor) for the component of BigCryptor64 incluing NDES.
    ///
    /// # Arguments
    /// - The argument `key` is the array of u8 that has 8 elements.
    /// - Remember that inverted parity bits do not affect the 56-bit real key.
    ///   So, [0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00],
    ///   [0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01],
    ///   [0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01],
    ///   [0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00],
    ///   [0x01, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01], etc.
    ///   are all the same keys. Each key has 255 different equivalent keys
    ///   in DES.
    ///
    /// # Features
    /// - You won't use this method unless you use NDES for such as Triple DES.
    /// - This method sets the key to be the given argument `key`.
    /// - This method constructs the encryptor component of NDES.
    ///
    /// # Example 1
    /// ```
    /// use cryptocol::symmetric::{ DES, BigCryptor64, SmallCryptor };
    /// 
    /// let keys: [Box<dyn SmallCryptor<u64, 8>>; 3]
    ///         = [ Box::new(DES::encryptor_with_key([0xEF_u8, 0xCD, 0xAB, 0x90, 0x78, 0x56, 0x34, 0x12])),
    ///             Box::new(DES::decryptor_with_key([0x21_u8, 0x43, 0x65, 0x87, 0x09, 0xBA, 0xDC, 0xFE])),
    ///             Box::new(DES::encryptor_with_key([0xEF_u8, 0xCD, 0xAB, 0x90, 0x78, 0x56, 0x34, 0x12])) ];
    /// let mut tdes = BigCryptor64::new_with_small_cryptor_array(keys);
    /// let plaintext = 0x_1234567890ABCDEF_u64;
    /// let ciphertext = tdes.encrypt_u64(plaintext);
    /// 
    /// println!("Plaintext:\t\t{:#018X}", plaintext);
    /// println!("Ciphertext:\t\t{:#018X}", ciphertext);
    /// assert_eq!(ciphertext, 0x272A2AC7B4E66748_u64);
    /// 
    /// let cipher_cipher_text = tdes.decrypt_u64(ciphertext);
    /// println!("Cipher-ciphertext:\t{:#018X}", cipher_cipher_text);
    /// assert_eq!(cipher_cipher_text, 0x1234567890ABCDEF_u64);
    /// assert_eq!(cipher_cipher_text, plaintext);
    /// ```
    ///
    /// # For more examples,
    /// click [here](./documentation/des_basic/struct.DES_Generic.html#method.encryptor_with_key)
    #[inline]
    pub fn encryptor_with_key(key: [u8; 8]) -> Self
    {
        Self::new_with_key(key)
    }

    // pub fn encryptor_with_key_u64(key: u64) -> Self
    /// Constructs a new object DES_Generic as a positive encryptor (or
    /// an encryptor) for the component of BigCryptor64 incluing NDES.
    ///
    /// # Arguments
    /// - The argument `key` is an unsigned integer that is of `u64`-type.
    /// - Remember that inverted parity bits do not affect the 56-bit real key.
    ///   So, 0x0000000000000000_u64, 0x0101010101010101_u64,
    ///   0x0000000000000001_u64, 0x0000000000000100_u64, 0x0100001000000001,
    ///   etc. are all the same keys. Each key has 255 different equivalent keys
    ///   in DES.
    ///
    /// # Features
    /// - You won't use this method unless you use NDES for such as Triple DES.
    /// - This method sets the key to be the given argument `key`.
    /// - This method constructs the encryptor component of NDES.
    ///
    /// # Example 1
    /// ```
    /// use cryptocol::symmetric::{ BigCryptor64, DES };
    /// 
    /// let mut tdes = BigCryptor64::new_with_small_cryptor_array(
    ///             [Box::new(DES::encryptor_with_key_u64(0x_1234567890ABCDEF_u64)),
    ///             Box::new(DES::decryptor_with_key_u64(0x_FEDCBA0987654321_u64)),
    ///             Box::new(DES::encryptor_with_key_u64(0x_1234567890ABCDEF_u64))]
    /// );
    /// let plaintext = 0x_1234567890ABCDEF_u64;
    /// let ciphertext = tdes.encrypt_u64(plaintext);
    /// 
    /// println!("Plaintext:\t\t{:#018X}", plaintext);
    /// println!("Ciphertext:\t\t{:#018X}", ciphertext);
    /// assert_eq!(ciphertext, 0x_272A2AC7B4E66748_u64);
    /// 
    /// let cipher_cipher_text = tdes.decrypt_u64(ciphertext);
    /// println!("Cipher-ciphertext:\t{:#018X}", cipher_cipher_text);
    /// assert_eq!(cipher_cipher_text, 0x1234567890ABCDEF_u64);
    /// assert_eq!(cipher_cipher_text, plaintext);
    /// ```
    ///
    /// # For more examples,
    /// click [here](./documentation/des_basic/struct.DES_Generic.html#method.encryptor_with_key_u64)
    #[inline]
    pub fn encryptor_with_key_u64(key: u64) -> Self
    {
        Self::new_with_key_u64(key)
    }

    // pub fn decryptor_with_key(key: [u8; 8]) -> Self
    /// Constructs a new object DES_Generic as a negative encryptor (or
    /// a decryptor) for the component of BigCryptor64 incluing NDES.
    ///
    /// # Arguments
    /// - The argument `key` is the array of u8 that has 8 elements.
    /// - Remember that inverted parity bits do not affect the 56-bit real key.
    ///   So, [0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00],
    ///   [0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01],
    ///   [0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01],
    ///   [0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00],
    ///   [0x01, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01], etc.
    ///   are all the same keys. Each key has 255 different equivalent keys
    ///   in DES.
    ///
    /// # Features
    /// - You won't use this method unless you use NDES for such as Triple DES.
    /// - This method sets the key to be the given argument `key`.
    /// - This method constructs the decryptor component of NDES.
    ///
    /// # Example 1
    /// ```
    /// use cryptocol::symmetric::{ DES, BigCryptor64, SmallCryptor };
    /// 
    /// let keys: [Box<dyn SmallCryptor<u64, 8>>; 3]
    ///         = [ Box::new(DES::encryptor_with_key([0xEF_u8, 0xCD, 0xAB, 0x90, 0x78, 0x56, 0x34, 0x12])),
    ///             Box::new(DES::decryptor_with_key([0x21_u8, 0x43, 0x65, 0x87, 0x09, 0xBA, 0xDC, 0xFE])),
    ///             Box::new(DES::encryptor_with_key([0xEF_u8, 0xCD, 0xAB, 0x90, 0x78, 0x56, 0x34, 0x12])) ];
    /// let mut tdes = BigCryptor64::new_with_small_cryptor_array(keys);
    /// let plaintext = 0x_1234567890ABCDEF_u64;
    /// let ciphertext = tdes.encrypt_u64(plaintext);
    /// 
    /// println!("Plaintext:\t\t{:#018X}", plaintext);
    /// println!("Ciphertext:\t\t{:#018X}", ciphertext);
    /// assert_eq!(ciphertext, 0x272A2AC7B4E66748_u64);
    /// 
    /// let cipher_cipher_text = tdes.decrypt_u64(ciphertext);
    /// println!("Cipher-ciphertext:\t{:#018X}", cipher_cipher_text);
    /// assert_eq!(cipher_cipher_text, 0x1234567890ABCDEF_u64);
    /// assert_eq!(cipher_cipher_text, plaintext);
    /// ```
    ///
    /// # For more examples,
    /// click [here](./documentation/des_basic/struct.DES_Generic.html#method.decryptor_with_key)
    pub fn decryptor_with_key(key: [u8; 8]) -> Self
    {
        let mut des = Self
        {
            key:        LongUnion::new_with_ubytes(key),
            block:      LongUnion::new(),
            round_key:  [0_u64; ROUND],
            enc:        Self::decrypt_u64,
            dec:        Self::encrypt_u64,
        };
        des.make_round_keys();
        des
    }

    // pub fn decryptor_with_key_u64(key: u64) -> Self
    /// Constructs a new object DES_Generic as a negative encryptor (or
    /// a decryptor) for the component of BigCryptor64 incluing NDES.
    ///
    /// # Arguments
    /// - The argument `key` is an unsigned integer that is of `u64`-type.
    /// - Remember that inverted parity bits do not affect the 56-bit real key.
    ///   So, 0x0000000000000000_u64, 0x0101010101010101_u64,
    ///   0x0000000000000001_u64, 0x0000000000000100_u64, 0x0100001000000001,
    ///   etc. are all the same keys. Each key has 255 different equivalent keys
    ///   in DES.
    ///
    /// # Features
    /// - You won't use this method unless you use NDES for such as Triple DES.
    /// - This method sets the key to be the given argument `key`.
    /// - This method constructs the decryptor component of NDES.
    ///
    /// # Example 1
    /// ```
    /// use cryptocol::symmetric::{ BigCryptor64, DES };
    /// 
    /// let mut tdes = BigCryptor64::new_with_small_cryptor_array(
    ///                 [ Box::new(DES::encryptor_with_key_u64(0x_1234567890ABCDEF_u64)),
    ///                                 Box::new(DES::decryptor_with_key_u64(0x_FEDCBA0987654321_u64)),
    ///                                 Box::new(DES::encryptor_with_key_u64(0x_1234567890ABCDEF_u64)) ] );
    /// let plaintext = 0x_1234567890ABCDEF_u64;
    /// let ciphertext = tdes.encrypt_u64(plaintext);
    /// 
    /// println!("Plaintext:\t\t{:#018X}", plaintext);
    /// println!("Ciphertext:\t\t{:#018X}", ciphertext);
    /// assert_eq!(ciphertext, 0x272A2AC7B4E66748_u64);
    /// 
    /// let cipher_cipher_text = tdes.decrypt_u64(ciphertext);
    /// println!("Cipher-ciphertext:\t{:#018X}", cipher_cipher_text);
    /// assert_eq!(cipher_cipher_text, 0x1234567890ABCDEF_u64);
    /// assert_eq!(cipher_cipher_text, plaintext);
    /// ```
    ///
    /// # For more examples,
    /// click [here](./documentation/des_basic/struct.DES_Generic.html#method.decryptor_with_key_u64)
    pub fn decryptor_with_key_u64(key: u64) -> Self
    {
        let mut des = Self
        {
            key:        LongUnion::new_with(key),
            block:      LongUnion::new(),
            round_key:  [0_u64; ROUND],
            enc:        Self::decrypt_u64,
            dec:        Self::encrypt_u64,
        };
        des.make_round_keys();
        des
    }

    // pub fn get_key(&mut self) -> [u8; 8]
    /// Gets the key.
    ///
    /// # Output
    /// This method returns the key in the form of array of `u8`.
    ///
    /// # Example
    /// ```
    /// use cryptocol::symmetric::DES;
    ///
    /// let mut des = DES::new();
    /// des.set_key([0x12, 0x34, 0x56, 0x78, 0x90, 0xAB, 0xCD, 0xEF]);
    /// let key = des.get_key();
    /// print!("K = ");
    /// for k in key
    ///     { print!("{:X02#} ", k); }
    /// assert_eq!(key, [0x12, 0x34, 0x56, 0x78, 0x90, 0xAB, 0xCD, 0xEF]);
    /// ```
    pub fn get_key(&mut self) -> [u8; 8]
    {
        let mut key = [0u8; 8];
        for i in 0..8
            { key[i] = self.key.get_ubyte_(i); }
        key
    }

    // pub fn get_key_u64(&self) -> u64
    /// Gets the key.
    ///
    /// # Output
    /// This method returns the key in the form of `u64`.
    ///
    /// # Example
    /// ```
    /// use cryptocol::symmetric::DES;
    ///
    /// let mut des = DES::new();
    /// des.set_key_u64(0xEFCDAB9078563412);
    /// let key = des.get_key_u64();
    /// println!("Key = {}", key);
    /// assert_eq!(key, 0xEFCDAB9078563412_u64);
    /// ```
    #[inline]
    pub fn get_key_u64(&self) -> u64
    {
        self.key.get_ulong()
    }

    // pub fn set_key(&mut self, key: [u8; 8])
    /// Sets the key.
    ///
    /// # Arguments
    /// - The argument `key` is the array of `u8` that has 8 elements.
    /// - Remember that inverted parity bits do not affect the 56-bit real key.
    ///   So, [0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00],
    ///   [0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01],
    ///   [0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01],
    ///   [0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00],
    ///   [0x01, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01], etc.
    ///   are all the same keys. Each key has 255 different equivalent keys
    ///   in DES.
    ///
    /// # Features
    /// This method sets the key to be the given argument `key`.
    ///
    /// # Example 1 for normal case
    /// ```
    /// use cryptocol::symmetric::DES;
    ///
    /// let mut des = DES::new();
    /// des.set_key([0x12, 0x34, 0x56, 0x78, 0x90, 0xAB, 0xCD, 0xEF]);
    /// let plaintext = 0x1234567890ABCDEF_u64;
    /// let ciphertext = des.encrypt_u64(plaintext);
    ///
    /// println!("Plaintext:\t\t{:#018X}", plaintext);
    /// println!("Ciphertext:\t\t{:#018X}", ciphertext);
    /// assert_eq!(ciphertext, 0x3B6041D76AF28F23_u64);
    ///
    /// let cipher_cipher_text = des.encrypt_u64(ciphertext);
    /// println!("Cipher-ciphertext:\t{:#018X}\n", cipher_cipher_text);
    /// assert_eq!(cipher_cipher_text, 0x7C5AAE491DC1310D_u64);
    /// assert_ne!(cipher_cipher_text, plaintext);
    /// ```
    ///
    /// # For more examples,
    /// click [here](./documentation/des_basic/struct.DES_Generic.html#method.set_key)
    pub fn set_key(&mut self, key: [u8; 8])
    {
        let mut i = 0_usize;
        for val in key
        {
            self.key.set_ubyte_(i, val);
            i += 1;
        }
        self.make_round_keys();
    }

    // pub fn set_key_u64(&mut self, key: u64)
    /// Sets the key.
    ///
    /// # Arguments
    /// - The argument `key` is of `u64`.
    /// - It should be in the same endianness of machine. For example,
    ///   if a key is [0x12, 0x34, 0x56, 0x78, 0x90, 0xAB, 0xCD, 0xEF],
    ///   the key in `u64` is 0x_1234567890ABCDEF_u64 for big-endian machine,
    ///   and the key in `u64` is 0x_EFCDAB9078563412_u64 for little-endian
    ///   machine.
    /// - Remember that inverted parity bits do not affect the 56-bit real key.
    ///   So, 0x_0000_0000_0000_0000_u4, 0x_0101_0101_0101_0101_u64,
    ///   0x_0000_0000_0000_0001_u64, 0x_0000_0000_0000_0100_u64,
    ///   0x_0100_0010_0000_0001_u64, etc. are all the same keys.
    ///   Each key has 255 different equivalent keys in DES.
    ///
    /// # Features
    /// This method sets the key to be the given argument `key`.
    ///
    /// # Example 1 for normal case
    /// ```
    /// use cryptocol::symmetric::DES;
    ///
    /// let mut des = DES::new();
    /// des.set_key_u64(0xEFCDAB9078563412);
    /// let plaintext = 0x1234567890ABCDEF_u64;
    /// let ciphertext = des.encrypt_u64(plaintext);
    ///
    /// println!("Plaintext:\t\t{:#018X}", plaintext);
    /// println!("Ciphertext:\t\t{:#018X}", ciphertext);
    /// assert_eq!(ciphertext, 0x3B6041D76AF28F23_u64);
    ///
    /// let cipher_cipher_text = des.encrypt_u64(ciphertext);
    /// println!("Cipher-ciphertext:\t{:#018X}\n", cipher_cipher_text);
    /// assert_eq!(cipher_cipher_text, 0x7C5AAE491DC1310D_u64);
    /// assert_ne!(cipher_cipher_text, plaintext);
    /// ```
    ///
    /// # For more examples,
    /// click [here](./documentation/des_basic/struct.DES_Generic.html#method.set_key_u64)
    pub fn set_key_u64(&mut self, key: u64)
    {
        self.key.set(key);
        self.make_round_keys();
    }

    pub(crate) fn move_to_next_key(&mut self)
    {
        let mut key = self.get_key();
        let mut carry = 2;
        let mut old: u8;
        for i in 0..8
        {
            old = key[i];
            key[i] = key[i].wrapping_add(carry);
            carry = if key[i] < old {2} else {0};
        }
        self.set_key(key);
        self.avoid_undesirable_key();
    }

    pub(crate) fn avoid_undesirable_key(&mut self)
    {
        while self.has_weak_key()
            { self.move_to_next_key(); }
    }

    // pub fn turn_inverse(&mut self)
    /// Flips its role in BigCryptor64.
    ///
    /// # Features
    /// - You won't use this method unless you use BigCryptor64 or NDES
    ///   for such as Triple DES.
    /// - Even if you are writing codes in the context of using BigCryptor64
    ///   or NDES, you will hardly use this method because it is high chance
    ///   that you will have constructed components with the methods,
    ///   [encryptor_with_key](struct@DES_Generic#method.encryptor_with_key),
    ///   [encryptor_with_key_u64](struct@DES_Generic#method.encryptor_with_key_u64),
    ///   [decryptor_with_key](struct@DES_Generic#method.decryptor_with_key), and
    ///   [decryptor_with_key_u64](struct@DES_Generic#method.decryptor_with_key_u64).
    /// - If it is constructed as encryptor for BigCryptor64 or NDES,
    ///   it will be changed into decryptor.
    /// - If it is constructed as decryptor for BigCryptor64 or NDES,
    ///   it will be changed into encryptor.
    ///
    /// # Example 1
    /// ```
    /// use cryptocol::symmetric::{ BigCryptor64, DES, SmallCryptor };
    /// 
    /// let mut keys: [Box<dyn SmallCryptor<u64, 8>>; 3]
    ///             = [ Box::new(DES::new_with_key_u64(0x_1234567890ABCDEF_u64)),
    ///                 Box::new(DES::new_with_key_u64(0x_FEDCBA0987654321_u64)),
    ///                 Box::new(DES::new_with_key_u64(0x_1234567890ABCDEF_u64)) ];
    /// keys[1].turn_inverse();
    /// 
    /// let mut tdes = BigCryptor64::new_with_small_cryptor_array(keys);
    /// let plaintext = 0x_1234567890ABCDEF_u64;
    /// let ciphertext = tdes.encrypt_u64(plaintext);
    /// 
    /// println!("Plaintext:\t\t{:#018X}", plaintext);
    /// println!("Ciphertext:\t\t{:#018X}", ciphertext);
    /// assert_eq!(ciphertext, 0x_272A2AC7B4E66748_u64);
    /// 
    /// let cipher_cipher_text = tdes.decrypt_u64(ciphertext);
    /// println!("Cipher-ciphertext:\t{:#018X}", cipher_cipher_text);
    /// assert_eq!(cipher_cipher_text, 0x1234567890ABCDEF_u64);
    /// assert_eq!(cipher_cipher_text, plaintext);
    /// ```
    ///
    /// # For more examples,
    /// click [here](./documentation/des_basic/struct.DES_Generic.html#method.turn_inverse)
    #[inline]
    pub fn turn_inverse(&mut self)
    {
        (self.enc, self.dec) = (self.dec, self.enc);
    }

    // pub fn turn_encryptor(&mut self)
    /// Changes its role in BigCryptor64 or NDES to encryptor.
    ///
    /// # Features
    /// - You won't use this method unless you use BigCryptor64 or NDES
    ///   for such as Triple DES.
    /// - Even if you are writing codes in the context of using BigCryptor64
    ///   or NDES, you will hardly use this method because it is high chance
    ///   that you will have constructed components with the methods,
    ///   [encryptor_with_key](struct@DES_Generic#method.encryptor_with_key),
    ///   [encryptor_with_key_u64](struct@DES_Generic#method.encryptor_with_key_u64),
    ///   [decryptor_with_key](struct@DES_Generic#method.decryptor_with_key), and
    ///   [decryptor_with_key_u64](struct@DES_Generic#method.decryptor_with_key_u64).
    /// - If it is constructed as encryptor for BigCryptor64 or NDES,
    ///   it will not be changed at all.
    /// - If it is constructed as decryptor for BigCryptor64 or NDES,
    ///   it will be changed into encryptor.
    ///
    /// # Example 1
    /// ```
    /// use cryptocol::symmetric::{ BigCryptor64, DES, SmallCryptor };
    /// 
    /// let mut keys: [Box<dyn SmallCryptor<u64, 8>>; 3]
    ///         = [ Box::new(DES::new_with_key_u64(0x_1234567890ABCDEF_u64)),
    ///             Box::new(DES::new_with_key_u64(0x_FEDCBA0987654321_u64)),
    ///             Box::new(DES::new_with_key_u64(0x_1234567890ABCDEF_u64)) ];
    /// keys[0].turn_encryptor();
    /// 
    /// let mut tdes = BigCryptor64::new_with_small_cryptor_array(keys);
    /// let plaintext = 0x_1234567890ABCDEF_u64;
    /// let ciphertext = tdes.encrypt_u64(plaintext);
    /// 
    /// println!("Plaintext:\t\t{:#018X}", plaintext);
    /// println!("Ciphertext:\t\t{:#018X}", ciphertext);
    /// assert_eq!(ciphertext, 0x_CDAC175F3B7EAA2B_u64);
    /// 
    /// let cipher_cipher_text = tdes.decrypt_u64(ciphertext);
    /// println!("Cipher-ciphertext:\t{:#018X}", cipher_cipher_text);
    /// assert_eq!(cipher_cipher_text, 0x1234567890ABCDEF_u64);
    /// assert_eq!(cipher_cipher_text, plaintext);
    /// ```
    ///
    /// # For more examples,
    /// click [here](./documentation/des_basic/struct.DES_Generic.html#method.turn_encryptor)
    pub fn turn_encryptor(&mut self)
    {
        self.enc = Self::encrypt_u64;
        self.dec = Self::decrypt_u64;
    }

    // pub fn turn_decryptor(&mut self)
    /// Changes its role in BigCryptor64 or NDES to decryptor.
    ///
    /// # Features
    /// - You won't use this method unless you use BigCryptor64 or NDES
    ///   for such as Triple DES.
    /// - Even if you are writing codes in the context of using BigCryptor64
    ///   or NDES, you will hardly use this method because it is high chance
    ///   that you will have constructed components with the methods,
    ///   [encryptor_with_key](struct@DES_Generic#method.encryptor_with_key),
    ///   [encryptor_with_key_u64](struct@DES_Generic#method.encryptor_with_key_u64),
    ///   [decryptor_with_key](struct@DES_Generic#method.decryptor_with_key), and
    ///   [decryptor_with_key_u64](struct@DES_Generic#method.decryptor_with_key_u64).
    /// - If it is constructed as encryptor for BigCryptor64 or NDES,
    ///   it will be changed into decryptor.
    /// - If it is constructed as decryptor for BigCryptor64 or NDES,
    ///   it will not be changed at all.
    ///
    /// # Example 1
    /// ```
    /// use cryptocol::symmetric::{ BigCryptor64, DES, SmallCryptor };
    /// 
    /// let mut keys: [Box<dyn SmallCryptor<u64, 8>>; 3]
    ///             = [ Box::new(DES::new_with_key_u64(0x_1234567890ABCDEF_u64)),
    ///                 Box::new(DES::new_with_key_u64(0x_FEDCBA0987654321_u64)),
    ///                 Box::new(DES::new_with_key_u64(0x_1234567890ABCDEF_u64)) ];
    /// keys[1].turn_decryptor();
    /// 
    /// let mut tdes = BigCryptor64::new_with_small_cryptor_array(keys);
    /// let plaintext = 0x_1234567890ABCDEF_u64;
    /// let ciphertext = tdes.encrypt_u64(plaintext);
    /// 
    /// println!("Plaintext:\t\t{:#018X}", plaintext);
    /// println!("Ciphertext:\t\t{:#018X}", ciphertext);
    /// assert_eq!(ciphertext, 0x_272A2AC7B4E66748_u64);
    /// 
    /// let cipher_cipher_text = tdes.decrypt_u64(ciphertext);
    /// println!("Cipher-ciphertext:\t{:#018X}", cipher_cipher_text);
    /// assert_eq!(cipher_cipher_text, 0x1234567890ABCDEF_u64);
    /// assert_eq!(cipher_cipher_text, plaintext);
    /// ```
    ///
    /// # For more examples,
    /// click [here](./documentation/des_basic/struct.DES_Generic.html#method.turn_decryptor)
    pub fn turn_decryptor(&mut self)
    {
        self.enc = Self::decrypt_u64;
        self.dec = Self::encrypt_u64;
    }

    // pub fn encrypt_u64(&mut self, message: u64) -> u64
    /// Encrypts a 64-bit data.
    ///
    /// # Arguments
    /// `message` is of `u64`-type and the plaintext to be encrypted.
    ///
    /// # Output
    /// This method returns the encrypted data of `u64`-type from `message`.
    /// 
    /// # Counterpart Methods
    /// For each trait
    /// [`ECB_PKCS7`](symmetric/trait.ECB_PKCS7.html#trait.ECB_PKCS7),
    /// [`ECB_ISO`](symmetric/trait.ECB_ISO.html#trait.ECB_ISO),
    /// [`CBC_PKCS7`](symmetric/trait.CBC_PKCS7.html#trait.ECB_PKCS7),
    /// [`CBC_ISO`](symmetric/trait.CBC_ISO.html#trait.CBC_ISO),
    /// [`PCBC_PKCS7`](symmetric/trait.PCBC_PKCS7.html#trait.PCBC_PKCS7),
    /// [`PCBC_ISO`](symmetric/trait.PCBC_ISO.html#trait.PCBC_ISO).
    /// [`CFB`](symmetric/trait.CFB.html#trait.CFB),
    /// [`OFB`](symmetric/trait.OFB.html#trait.OFB), and
    /// [`CTR`](symmetric/trait.CTR.html#trait.CTR),
    /// there are provided useful counterpart methods:
    /// encrypt(), encrypt_into_vec(), encrypt_into_array(),
    /// encrypt_str(), encrypt_str_into_vec(), encrypt_str_into_array(),
    /// encrypt_string(), encrypt_string_into_vec(), encrypt_string_into_array(),
    /// encrypt_vec(), encrypt_vec_into_vec(), encrypt_vec_into_array(),
    /// encrypt_array(), encrypt_array_into_vec(), and encrypt_array_into_array().
    ///
    /// # Example 1 for Normal case
    /// ```
    /// use cryptocol::symmetric::DES;
    ///
    /// let key = 0x_1234567890ABCDEF_u64;
    /// println!("K =\t{:#018X}", key);
    ///
    /// let message = 0x_1234567890ABCDEF_u64;
    /// println!("M_u64 =\t{:#018X}", message);
    ///
    /// let mut a_des = DES::new_with_key_u64(key);
    /// let cipher = a_des.encrypt_u64(message);
    /// println!("C_u64 (16 rounds) =\t{:#018X}", cipher);
    /// assert_eq!(cipher, 0x_1BC4896735BBE206_u64);
    /// ```
    ///
    /// # For more examples,
    /// click [here](./documentation/des_basic/struct.DES_Generic.html#method.encrypt_u64)
    pub fn encrypt_u64(&mut self, message: u64) -> u64
    {
        self.set_block(message);
        self.encrypt_block();
        self.get_block()
    }

    // pub fn decrypt_u64(&mut self, cipher: u64) -> u64
    /// Decrypts a 64-bit data.
    ///
    /// # Arguments
    /// `cioher` is of `u64`-type and the ciphertext to be decrypted.
    ///
    /// # Output
    /// This method returns the decrypted data of `u64`-type from `cipher`.
    /// 
    /// # Counterpart Methods
    /// For each trait
    /// [`ECB_PKCS7`](symmetric/trait.ECB_PKCS7.html#trait.ECB_PKCS7),
    /// [`ECB_ISO`](symmetric/trait.ECB_ISO.html#trait.ECB_ISO),
    /// [`CBC_PKCS7`](symmetric/trait.CBC_PKCS7.html#trait.ECB_PKCS7),
    /// [`CBC_ISO`](symmetric/trait.CBC_ISO.html#trait.CBC_ISO),
    /// [`PCBC_PKCS7`](symmetric/trait.PCBC_PKCS7.html#trait.PCBC_PKCS7),
    /// [`PCBC_ISO`](symmetric/trait.PCBC_ISO.html#trait.PCBC_ISO).
    /// [`CFB`](symmetric/trait.CFB.html#trait.CFB),
    /// [`OFB`](symmetric/trait.OFB.html#trait.OFB), and
    /// [`CTR`](symmetric/trait.CTR.html#trait.CTR),
    /// there are provided useful counterpart methods:
    /// decrypt(), decrypt_into_vec(), decrypt_into_array(),
    /// decrypt_into_string(),
    /// decrypt_vec(), decrypt_vec_into_vec(), decrypt_vec_into_array(),
    /// decrypt_vec_into_string(),
    /// decrypt_array(), decrypt_array_into_vec(), decrypt_array_into_array(),
    /// and decrypt_array_into_string().
    /// 
    /// # Example 1 for Normal case
    /// ```
    /// use cryptocol::symmetric::DES;
    ///
    /// let key = 0x_1234567890ABCDEF_u64;
    /// println!("K =\t{:#018X}", key);
    ///
    /// let message = 0x_1234567890ABCDEF_u64;
    /// println!("M_u64 =\t{:#018X}", message);
    ///
    /// let mut a_des = DES::new_with_key_u64(key);
    /// let cipher = a_des.encrypt_u64(message);
    /// println!("C_u64 (16 rounds) =\t{:#018X}", cipher);
    /// assert_eq!(cipher, 0x_1BC4896735BBE206_u64);
    ///
    /// let recovered = a_des.decrypt_u64(cipher);
    /// println!("B_u64 (16 rounds) =\t{:#018X}", recovered);
    /// assert_eq!(recovered, 0x_1234567890ABCDEF_u64);
    /// assert_eq!(recovered, message);
    /// ```
    ///
    /// # For more examples,
    /// click [here](./documentation/des_basic/struct.DES_Generic.html#method.decrypt_u64)
    pub fn decrypt_u64(&mut self, cipher: u64) -> u64
    {
        self.set_block(cipher);
        self.decrypt_block();
        self.get_block()
    }

    // pub(super) fn _encrypt(&mut self, message: u64) -> u64
    /// Encrypts a 64-bit data when NDES encrypting if the object was
    /// constructed as encryptor for NDES such as Triple DES, and decrypts a
    /// 64-bit data when NDES encrypting if the object was constructed as
    /// decryptor for NDES such as Triple DES.
    ///
    /// # Arguments
    /// `message` is of `u64`-type and the plaintext to be encrypted.
    ///
    /// # Output
    /// This method returns the encrypted data of `u64`-type from `message`.
    ///
    /// # Example 1 for Normal case
    /// ```
    /// use cryptocol::symmetric::DES;
    ///
    /// let key = 0x_1234567890ABCDEF_u64;
    /// println!("K =\t{:#018X}", key);
    ///
    /// let message = 0x_1234567890ABCDEF_u64;
    /// println!("M_u64 =\t{:#018X}", message);
    ///
    /// let mut a_des = DES::new_with_key_u64(key);
    /// let cipher = a_des._encrypt(message);
    /// println!("C_u64 (16 rounds) =\t{:#018X}", cipher);
    /// assert_eq!(cipher, 0x_1BC4896735BBE206_u64);
    /// ```
    ///
    /// # For more examples,
    /// click [here](./documentation/des_basic/struct.DES_Generic.html#method._encrypt)
    #[inline]
    pub(super) fn _encrypt(&mut self, message: u64) -> u64
    {
        (self.enc)(self, message)
    }

    // pub(super) fn _decrypt(&mut self, cipher: u64) -> u64
    /// Decrypts a 64-bit data when NDES decrypting if the object was
    /// constructed as encryptor for NDES such as Triple DES, and encrypts a
    /// 64-bit data when NDES decrypting if the object was constructed as
    /// decryptor for NDES such as Triple DES.
    ///
    /// # Arguments
    /// `cipher` is of `u64`-type and the ciphertext to be decrypted.
    ///
    /// # Output
    /// This method returns the decrypted data of `u64`-type from `cipher`.
    ///
    /// # Example 1 for Normal case
    /// ```
    /// use cryptocol::symmetric::DES;
    ///
    /// let key = 0x_1234567890ABCDEF_u64;
    /// println!("K =\t{:#018X}", key);
    ///
    /// let message = 0x_1234567890ABCDEF_u64;
    /// println!("M_u64 =\t{:#018X}", message);
    ///
    /// let mut a_des = DES::new_with_key_u64(key);
    /// let cipher = a_des._encrypt(message);
    /// println!("C_u64 (16 rounds) =\t{:#018X}", cipher);
    /// assert_eq!(cipher, 0x_1BC4896735BBE206_u64);
    ///
    /// let recovered = a_des._decrypt(cipher);
    /// println!("B_u64 (16 rounds) =\t{:#018X}", recovered);
    /// assert_eq!(recovered, 0x_1234567890ABCDEF_u64);
    /// assert_eq!(recovered, message);
    /// ```
    ///
    /// # For more examples,
    /// click [here](./documentation/des_basic/struct.DES_Generic.html#method._decrypt)
    #[inline]
    pub(super) fn _decrypt(&mut self, cipher: u64) -> u64
    {
        (self.dec)(self, cipher)
    }

    // pub fn encrypt_array_u64<const N: usize>(&mut self, message: &[u64; N], cipher: &mut [u64; N])
    /// Encrypts an array of 64-bit data.
    ///
    /// # Arguments
    /// - `message` is of an array of `u64`-type and the plaintext to be
    ///   encrypted.
    /// - `cipher` is of an array of `u64`-type and the ciphertext to be stored.
    ///
    /// # Features
    /// This method encrypts multiple of 64-bit data without padding anything
    /// in ECB (Electronic CodeBook) mode.
    ///
    /// # Counterpart methods
    /// For each trait
    /// [`ECB_PKCS7`](symmetric/trait.ECB_PKCS7.html#trait.ECB_PKCS7),
    /// [`ECB_ISO`](symmetric/trait.ECB_ISO.html#trait.ECB_ISO),
    /// [`CBC_PKCS7`](symmetric/trait.CBC_PKCS7.html#trait.ECB_PKCS7),
    /// [`CBC_ISO`](symmetric/trait.CBC_ISO.html#trait.CBC_ISO),
    /// [`PCBC_PKCS7`](symmetric/trait.PCBC_PKCS7.html#trait.PCBC_PKCS7),
    /// [`PCBC_ISO`](symmetric/trait.PCBC_ISO.html#trait.PCBC_ISO).
    /// [`CFB`](symmetric/trait.CFB.html#trait.CFB),
    /// [`OFB`](symmetric/trait.OFB.html#trait.OFB), and
    /// [`CTR`](symmetric/trait.CTR.html#trait.CTR),
    /// there are provided useful counterpart methods:
    /// encrypt(), encrypt_into_vec(), encrypt_into_array(),
    /// encrypt_str(), encrypt_str_into_vec(), encrypt_str_into_array(),
    /// encrypt_string(), encrypt_string_into_vec(), encrypt_string_into_array(),
    /// encrypt_vec(), encrypt_vec_into_vec(), encrypt_vec_into_array(),
    /// encrypt_array(), encrypt_array_into_vec(), and encrypt_array_into_array(),.
    /// 
    /// # Example 1 for Normal case
    /// ```
    /// use cryptocol::symmetric::DES;
    ///
    /// let key = 0x_1234567890ABCDEF_u64;
    /// println!("K =\t{:#018X}", key);
    ///
    /// let message = [0x_1234567890ABCDEF_u64, 0xEFCDAB9078563412, 0xFEDCBA0987654321 ];
    /// print!("M =\t");
    /// for m in message
    ///     { print!("{:#018X} ", m); }
    /// println!();
    /// let mut a_des = DES::new_with_key_u64(key);
    ///
    /// let mut cipher = [0; 3];
    /// a_des.encrypt_array_u64(&message, &mut cipher);
    /// print!("C (16 rounds) =\t");
    /// for c in cipher
    ///     { print!("{:#018X} ", c); }
    /// println!();
    /// assert_eq!(cipher[0], 0x_1BC4896735BBE206_u64);
    /// assert_eq!(cipher[1], 0x_1D8A61E5E62226A4_u64);
    /// assert_eq!(cipher[2], 0x_2990D69525C17067_u64);
    /// ```
    ///
    /// # For more examples,
    /// click [here](./documentation/des_basic/struct.DES_Generic.html#method.encrypt_array_u64)
    pub fn encrypt_array_u64<const N: usize>(&mut self, message: &[u64; N], cipher: &mut [u64; N])
    {
        for i in 0..N
        {
            self.set_block(message[i]);
            self.encrypt_block();
            cipher[i] = self.get_block();
        }
    }

    // pub fn decrypt_array_u64<const N: usize>(&mut self, cipher: &[u64; N], message: &mut [u64; N])
    /// Decrypts an array of 64-bit data.
    ///
    /// # Arguments
    /// - `cipher` is of an array of `u64`-type and the ciphertext to be
    ///   decrypted.
    /// - `message` is of an array of `u64`-type and the plaintext to be stored.
    ///
    /// # Features
    /// This method decrypts multiple of 64-bit data without padding anything
    /// in ECB (Electronic CodeBook) mode.
    /// 
    /// # Counterpart Methods
    /// For each trait
    /// [`ECB_PKCS7`](symmetric/trait.ECB_PKCS7.html#trait.ECB_PKCS7),
    /// [`ECB_ISO`](symmetric/trait.ECB_ISO.html#trait.ECB_ISO),
    /// [`CBC_PKCS7`](symmetric/trait.CBC_PKCS7.html#trait.ECB_PKCS7),
    /// [`CBC_ISO`](symmetric/trait.CBC_ISO.html#trait.CBC_ISO),
    /// [`PCBC_PKCS7`](symmetric/trait.PCBC_PKCS7.html#trait.PCBC_PKCS7),
    /// [`PCBC_ISO`](symmetric/trait.PCBC_ISO.html#trait.PCBC_ISO).
    /// [`CFB`](symmetric/trait.CFB.html#trait.CFB),
    /// [`OFB`](symmetric/trait.OFB.html#trait.OFB), and
    /// [`CTR`](symmetric/trait.CTR.html#trait.CTR),
    /// there are provided useful counterpart methods:
    /// decrypt(), decrypt_into_vec(), decrypt_into_array(),
    /// decrypt_into_string(),
    /// decrypt_vec(), decrypt_vec_into_vec(), decrypt_vec_into_array(),
    /// decrypt_vec_into_string(),
    /// decrypt_array(), decrypt_array_into_vec(), decrypt_array_into_array(),
    /// and decrypt_array_into_string().
    /// 
    /// # Example 1 for Normal case
    /// ```
    /// use cryptocol::symmetric::DES;
    ///
    /// let key = 0x_1234567890ABCDEF_u64;
    /// println!("K =\t{:#018X}", key);
    ///
    /// let message = [0x_1234567890ABCDEF_u64, 0xEFCDAB9078563412, 0xFEDCBA0987654321 ];
    /// print!("M =\t");
    /// for m in message
    ///     { print!("{:#018X} ", m); }
    /// println!();
    /// let mut a_des = DES::new_with_key_u64(key);
    ///
    /// let mut cipher = [0; 3];
    /// a_des.encrypt_array_u64(&message, &mut cipher);
    /// print!("C (16 rounds) =\t");
    /// for c in cipher
    ///     { print!("{:#018X} ", c); }
    /// println!();
    /// assert_eq!(cipher[0], 0x_1BC4896735BBE206_u64);
    /// assert_eq!(cipher[1], 0x_1D8A61E5E62226A4_u64);
    /// assert_eq!(cipher[2], 0x_2990D69525C17067_u64);
    ///
    /// let mut recovered = [0; 3];
    /// a_des.decrypt_array_u64(&cipher, &mut recovered);
    /// print!("B (16 rounds) =\t");
    /// for r in recovered
    ///     { print!("{:#018X} ", r); }
    /// println!();
    /// assert_eq!(recovered[0], 0x_1234567890ABCDEF_u64);
    /// assert_eq!(recovered[1], 0x_EFCDAB9078563412_u64);
    /// assert_eq!(recovered[2], 0x_FEDCBA0987654321_u64);
    /// ```
    ///
    /// # For more examples,
    /// click [here](./documentation/des_basic/struct.DES_Generic.html#method.decrypt_array_u64)
    pub fn decrypt_array_u64<const N: usize>(&mut self, cipher: &[u64; N], message: &mut [u64; N])
    {
        for i in 0..N
        {
            self.set_block(cipher[i]);
            self.decrypt_block();
            message[i] = self.get_block();
        }
    }

    // pub fn is_succeful(&self) -> bool
    /// Checks whether the previous encryption or decryption was successful.
    ///
    /// # Output
    /// If the previous encryption or decryption was successful, this method
    /// returns true. Otherwise, it returns false.
    ///
    /// # Features
    /// - Usually, you don't have to use this method because the encryption
    ///   methods returns the length of ciphertext and the decryption methods
    ///   returns the length of plaintext but they returns `0` when they failed.
    /// - If the ciphertext is 8 bytes for decryption with the padding either
    ///   pkcs7 or iso, the return value `0` of the decryption methods is not
    ///   discriminatory. You don't know whether the previous decryption was
    ///   failed or the original plaintext was just null string or "". In this
    ///   case you can check its success with this method.
    ///
    /// # Example 1 for Normal case for the message of 0 bytes
    /// ```
    /// use std::io::Write;
    /// use std::fmt::Write as _;
    /// use cryptocol::symmetric::{ DES, ECB_PKCS7 };
    /// 
    /// let key = 0x_1234567890ABCDEF_u64;
    /// println!("K =\t{:#018X}", key);
    /// let mut a_des = DES::new_with_key_u64(key);
    /// let message = "";
    /// println!("M =\t{}", message);
    /// let mut cipher = [0_u8; 8];
    /// let len = a_des.encrypt_into_array(message.as_ptr(), message.len() as u64, &mut cipher);
    /// println!("The length of ciphertext = {}", len);
    /// assert_eq!(len, 8);
    /// let success = a_des.is_successful();
    /// assert_eq!(success, true);
    /// print!("C =\t");
    /// for c in cipher.clone()
    ///     { print!("{:02X} ", c); }
    /// println!();
    /// let mut txt = String::new();
    /// for c in cipher.clone()
    ///     { write!(txt, "{:02X} ", c); }
    /// assert_eq!(txt, "41 7F 89 79 08 CD A1 4C ");
    /// ```
    ///
    /// # For more examples,
    /// click [here](./documentation/des_basic/struct.DES_Generic.html#method.is_successful)
    #[inline]
    pub fn is_successful(&self) -> bool
    {
        self.block.get() == Self::SUCCESS
    }

    // pub fn is_failed(&self) -> bool
    /// Checks whether the previous encryption or decryption was failed.
    ///
    /// # Output
    /// If the previous encryption or decryption was failed, this method
    /// returns true. Otherwise, it returns false.
    ///
    /// # Features
    /// - Usually, you don't have to use this method because the encryption
    ///   methods returns the length of ciphertext and the decryption methods
    ///   returns the length of plaintext but they returns `0` when they failed.
    /// - If the ciphertext is 8 bytes for decryption with the padding either
    ///   pkcs7 or iso, the return value `0` of the decryption methods is not
    ///   discriminatory. You don't know whether the previous decryption was
    ///   failed or the original plaintext was just null string or "". In this
    ///   case you can check its success with this method.
    ///
    /// # Example 1 for Normal case for the message of 0 bytes
    /// ```
    /// use std::io::Write;
    /// use std::fmt::Write as _;
    /// use cryptocol::symmetric::{ DES, ECB_PKCS7 };
    ///
    /// let key = 0x_1234567890ABCDEF_u64;
    /// println!("K =\t{:#018X}", key);
    /// let mut a_des = DES::new_with_key_u64(key);
    ///
    /// let message = "";
    /// println!("M =\t{}", message);
    /// let mut cipher = [0_u8; 8];
    /// let len = a_des.encrypt_str_into_array(message.as_ptr(), message.len() as u64, &mut cipher);
    /// println!("The length of ciphertext = {}", len);
    /// assert_eq!(len, 8);
    /// let failure = a_des.is_failed();
    /// assert_eq!(failure, false);
    /// print!("C =\t");
    /// for c in cipher.clone()
    ///     { print!("{:02X} ", c); }
    /// println!();
    /// let mut txt = String::new();
    /// for c in cipher.clone()
    ///     { write!(txt, "{:02X} ", c); }
    /// assert_eq!(txt, "41 7F 89 79 08 CD A1 4C ");
    /// ```
    ///
    /// # For more examples,
    /// click [here](./documentation/des_basic/struct.DES_Generic.html#method.is_failed)
    #[inline]
    pub fn is_failed(&self) -> bool
    {
        self.block.get() == Self::FAILURE
    }

    // pub(super) fn set_successful(&mut self)
    /// Sets the flag to mean that the previous encryption or decryption
    /// was successful.
    ///
    /// # Features
    /// You won't use this method unless you write codes for implementation
    /// of a trait for BigCryptor64 or NDES.
    ///
    /// # Example
    /// ```
    /// use cryptocol::symmetric::DES;
    /// let mut a_des = DES::new_with_key_u64(0x_1234567890ABCDEF_u64);
    /// assert_eq!(a_des.is_successful(), false);
    ///
    /// a_des.set_successful();
    /// assert_eq!(a_des.is_successful(), true);
    /// ```
    #[inline]
    pub(super) fn set_successful(&mut self)
    {
        self.block.set(Self::SUCCESS);
    }

    // pub(super) fn set_failed(&mut self)
    /// Sets the flag to mean that the previous encryption or decryption
    /// was failed.
    ///
    /// # Features
    /// You won't use this method unless you write codes for implementation
    /// of a trait for BigCryptor64 or NDES.
    ///
    /// # Example
    /// ```
    /// use cryptocol::symmetric::DES;
    /// let mut a_des = DES::new_with_key_u64(0x_1234567890ABCDEF_u64);
    /// a_des.encrypt_u64(0x1234567890ABCDEF_u64);
    /// assert_eq!(a_des.is_failed(), false);
    ///
    /// a_des.set_failed();
    /// assert_eq!(a_des.is_failed(), true);
    /// ```
    #[inline]
    pub(super) fn set_failed(&mut self)
    {
        self.block.set(Self::FAILURE);
    }

    // pub fn has_weak_key(&self) -> bool
    /// Checks wether or not it has a weak key.
    ///
    /// # Output
    /// This method returns `true` if it has a weak key.
    /// Otherwise, it returns `false`.
    ///
    /// # Example 1 for not weak key
    /// ```
    /// use cryptocol::symmetric::DES;
    ///
    /// let key = 0x_1234567890ABCDEF_u64;
    /// let mut a_des = DES::new_with_key_u64(key);
    /// let weak_key = a_des.has_weak_key();
    /// println!("{:016X} is {}a weak key.", key.to_be(), if weak_key {""} else {"not "});
    /// assert_eq!(weak_key, false);
    /// ```
    ///
    /// # Example 2 for weak key
    /// ```
    /// use cryptocol::symmetric::DES;
    ///
    /// let key = 0x_0000000000000000_u64;
    /// a_des.set_key_u64(key);
    /// let weak_key = a_des.has_weak_key();
    /// println!("{:016X} is {}a weak key.", key.to_be(), if weak_key {""} else {"not "});
    /// assert_eq!(weak_key, true);
    /// ```
    ///
    /// # For more examples,
    /// click [here](./documentation/des_basic/struct.DES_Generic.html#method.has_weak_key)
    #[inline]
    pub fn has_weak_key(&mut self) -> bool
    {
        let cipher = self.encrypt_u64(0);
        self.encrypt_u64(cipher) == 0
    }

    // pub fn is_equivalent_key_u64(&mut self, key: u64) -> bool
    /// Checks wether or not it `key` is equivalent to its key.
    ///
    /// # Output
    /// This method returns `true` if it is equivalent to its key.
    /// Otherwise, it returns `false`.
    #[inline]
    pub fn is_equivalent_key_u64(&mut self, key: u64) -> bool
    {
        key & Self::MASK == self.key.get() & Self::MASK
    }

    // pub fn is_equivalent_key(&mut self, key: &[u8; 8]) -> bool
    /// Checks wether or not it `key` is equivalent to its key.
    ///
    /// # Output
    /// This method returns `true` if it is equivalent to its key.
    /// Otherwise, it returns `false`.
    #[inline]
    pub fn is_equivalent_key(&mut self, key: &[u8; 8]) -> bool
    {
        LongUnion::new_with_ubytes(*key).get() & Self::MASK == self.key.get() & Self::MASK
    }


    fn encrypt_block(&mut self)
    {
        self.permutate_initially();
        for round in 0..ROUND
            { self.feistel(round); }
        let left = self.block.get_uint_(0);
        let right = self.block.get_uint_(1);
        self.block.set_uint_(0, right);
        self.block.set_uint_(1, left);
        self.permutate_finally();
    }

    fn decrypt_block(&mut self)
    {
        self.permutate_initially();
        for round in 0..ROUND
            { self.feistel(ROUND - 1 - round); }
        let left = self.block.get_uint_(0);
        let right = self.block.get_uint_(1);
        self.block.set_uint_(0, right);
        self.block.set_uint_(1, left);
        self.permutate_finally();
    }

    #[allow(dead_code)]
    fn feistel(&mut self, round: usize)
    {
        const LEFT: usize = 0;
        const RIGHT: usize = 1;
        let right = self.block.get_uint_(RIGHT);
        let left = self.block.get_uint_(LEFT) ^ self.f(round, right);
        self.block.set_uint_(LEFT, right);
        self.block.set_uint_(RIGHT, left);
    }

    #[allow(dead_code)]
    fn f(&mut self, round: usize, right: u32) -> u32
    {
        let expanded = self.expand(right);
        let indices = expanded ^ self.round_key[round];
        let mut idx = [0_usize; 8];
        slice_index!(indices, idx);
        let mut out = 0_u32;
        for i in 0..4
        {
            let left = i * 2;
            let right = left + 1;
            combine_pieces!(out, ((Self::SBOX[left][idx[left]] << 4) | Self::SBOX[right][idx[right]]) as u32);
        }
        self.translate(out)
    }

    fn make_round_keys(&mut self)
    {
        let (mut left, mut right) = self.split();
        let mut shift = SHIFT;
        for i in 0..ROUND
        {
            rotate_halfkey!(left, shift.is_even());
            rotate_halfkey!(right, shift.is_even());
            self.make_a_round_key(i, left, right);
            shift >>= 1;
        }
    }

    fn make_a_round_key(&mut self, round: usize, left: IntUnion, mut right: IntUnion)
    {
        let tail = right.get_ubyte_(0) >> 4;
        shift_left_union!(right, 4);
        let mut whole = LongUnion::new_with_uints([left.get(), right.get()]);
        whole.set_ubyte_(3, whole.get_ubyte_(3) | tail);
        self.round_key[round] = self.compress_into_48bits(whole.get());
    }

    fn split(&self) -> (IntUnion, IntUnion)
    {
        let key_56bit = self.compress_into_56bits();
        let key = LongUnion::new_with(key_56bit);
        let mut left = IntUnion::new_with(key.get_uint_(0));
        left.set_ubyte_(3, left.get_ubyte_(3) & 0b_1111_0000);
        let mut right = IntUnion::new_with(key.get_uint_(1));
        shift_right_union!(right, 4);
        right.set_ubyte_(0, (key.get_ubyte_(3) << 4) | right.get_ubyte_(0));
        (left, right)
    }

    fn permutate_initially(&mut self)   { permutate_data!(self, Self::IP); }
    fn permutate_finally(&mut self)     { permutate_data!(self, Self::FP); }
    fn compress_into_56bits(&self) -> u64   { return permutate_data!(Self::PC1, u64, self.key.get()); }
    fn compress_into_48bits(&self, whole: u64) -> u64   { return permutate_data!(Self::PC2, u64, whole); }
    fn expand(&self, right: u32) -> u64     { return permutate_data!(Self::EP, u64, right);}
    fn translate(&self, right: u32) -> u32  { return permutate_data!(Self::TP, u32, right); }

    #[inline] fn get_block(&self) -> u64            { self.block.get() }
    #[inline] fn set_block(&mut self, block: u64)   { self.block.set(block); }




    ////// for unit test /////
    // #[inline] pub fn test_get_block(&self) -> u64           { self.block.get() }
    // #[inline] pub fn test_set_block(&mut self, block: u64)  { self.block.set(block); }
    //
    // pub fn test_set_key(&mut self, key: [u8; 8])
    // {
    //     for i in 0..8
    //         { self.key.set_ubyte_(i, key[i]); }
    // }
    //
    // pub fn test_permutate_initially(&mut self)    { permutate_data!(self, Self::IP); }
    // pub fn test_permutate_finally(&mut self)      { permutate_data!(self, Self::FP); }
    // #[inline] pub fn test_expand(&self, right: u32) -> u64  { self.expand(right) }
    // #[inline] pub fn test_compress_into_56bits(&self) -> u64    { self.compress_into_56bits() }
    // #[inline] pub fn test_split(&self) -> (IntUnion, IntUnion)  { self.split() }
    // #[inline] pub fn test_make_round_keys(&mut self)    { self.make_round_keys(); }
    // #[inline] pub fn test_get_round_key(&self, round: usize) -> u64  { self.round_key[round] }
    // pub fn test_slice_indices(&self, indices: u64, array: &mut [usize; 8])   { slice_index!(indices, array); }
    // pub fn test_combine(&self, collector: &mut u32, piece: u32) { combine_pieces!(*collector, piece); }
    // pub fn test_f(&mut self, round: usize, right: u32) -> u32   { self.f(round, right) }
}