pqbip39 0.2.0

A no_std compatible implementation of the BIP39 mnemonic code standard.
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
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
#[cfg(feature = "std")]
use std::borrow::Cow;
#[cfg(feature = "std")]
use unicode_normalization::UnicodeNormalization;

use crate::{errors::Bip39Error, pbkdf2::pbkdf2, rng::Rng, utils::is_invalid_word_count};
use core::fmt;
use secrecy::{ExposeSecret, SecretBox, SecretSlice, SecretString, zeroize::Zeroize};
use sha2::{Digest, Sha256};

pub const MIN_NB_WORDS: usize = 12;
pub const MAX_NB_WORDS: usize = 33;
pub const MAX_ENTROPY_BYTES: usize = 32;
pub const MAX_WORDS_DICT: usize = 2048;
pub const PBKDF2_ROUNDS: u32 = 2048;
pub const SEED_BYTE_LEN: usize = 64;

const EOF: u16 = u16::max_value();

#[derive(PartialEq, Eq, Clone)]
pub struct Mnemonic<'a> {
    lang_words: &'a [&'a str; MAX_WORDS_DICT],
    indicators: [u16; MAX_NB_WORDS],
    pub word_count: usize,
}

#[derive(Clone)]
pub struct MnemonicIter<'a, 'b> {
    mnemonic: &'b Mnemonic<'a>,
    position: usize,
}

#[derive(Clone)]
pub struct EntropyIter<'a> {
    mnemonic: &'a Mnemonic<'a>,
    word_idx: usize,
    bits: u32,
    bit_count: u32,
    bytes_produced: usize,
    bytes_to_produce: usize,
}

impl<'a> Iterator for EntropyIter<'a> {
    type Item = u8;

    fn next(&mut self) -> Option<Self::Item> {
        if self.bytes_produced >= self.bytes_to_produce {
            return None;
        }

        while self.bit_count < 8 {
            if self.word_idx >= self.mnemonic.word_count {
                return None;
            }

            let index = self.mnemonic.indicators[self.word_idx];

            self.bits = (self.bits << 11) | u32::from(index);
            self.bit_count += 11;
            self.word_idx += 1;
        }

        let shift = self.bit_count - 8;
        let byte = (self.bits >> shift) as u8;

        self.bit_count -= 8;
        self.bits &= (1 << self.bit_count) - 1;

        self.bytes_produced += 1;

        Some(byte)
    }
}

impl<'a, 'b> Iterator for MnemonicIter<'a, 'b> {
    type Item = &'a str;

    fn next(&mut self) -> Option<Self::Item> {
        if self.position >= self.mnemonic.word_count {
            return None;
        }
        let word_index = self.mnemonic.indicators[self.position] as usize;
        self.position += 1;
        Some(self.mnemonic.lang_words[word_index])
    }
}

impl<'a> fmt::Debug for Mnemonic<'a> {
    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
        write!(f, "Mnemonic([REDACTED])")
    }
}

impl<'a> Zeroize for Mnemonic<'a> {
    fn zeroize(&mut self) {
        self.indicators.zeroize();
        self.word_count.zeroize();
    }
}

impl<'a> Mnemonic<'a> {
    pub fn from(dictionary: &'a [&'a str; MAX_WORDS_DICT]) -> Self {
        Self {
            lang_words: dictionary,
            indicators: [EOF; MAX_NB_WORDS],
            word_count: 0,
        }
    }

    pub(crate) fn iter<'b>(&'b self) -> MnemonicIter<'a, 'b> {
        MnemonicIter {
            mnemonic: self,
            position: 0,
        }
    }

    pub fn words(&self) -> impl Iterator<Item = SecretString> + '_ {
        self.iter().map(SecretString::from)
    }

    pub fn to_phrase(&self) -> SecretString {
        let mut phrase = String::new();
        for (i, word) in self.iter().enumerate() {
            if i > 0 {
                phrase.push(' ');
            }
            phrase.push_str(word);
        }
        SecretString::from(phrase)
    }

    pub fn to_seed(&self, passphrase: &SecretString) -> Result<SecretBox<[u8; SEED_BYTE_LEN]>, Bip39Error> {
        #[cfg(not(feature = "std"))]
        let normalized_passphrase = passphrase.expose_secret();

        #[cfg(feature = "std")]
        let normalized_passphrase = {
            let mut cow = passphrase.expose_secret().into();
            Mnemonic::normalize_utf8_cow(&mut cow);
            cow
        };

        pbkdf2(self.iter(), normalized_passphrase.as_bytes(), PBKDF2_ROUNDS)
    }

    #[inline]
    #[cfg(feature = "unicode-normalization")]
    pub fn normalize_utf8_cow<'b>(cow: &mut Cow<'b, str>) {
        let is_nfkd = unicode_normalization::is_nfkd_quick(cow.as_ref().chars());
        if is_nfkd != unicode_normalization::IsNormalized::Yes {
            *cow = Cow::Owned(cow.as_ref().nfkd().to_string());
        }
    }

    pub fn parse_str(
        lang_words: &'a [&'a str; MAX_WORDS_DICT],
        s: &SecretString,
    ) -> Result<Self, Bip39Error> {
        const MAX_TOTAL_BITS: usize = MAX_NB_WORDS * 11;
        const MAX_ENTROPY_BYTES_LOCAL: usize = 256 / 8;

        #[cfg(feature = "std")]
        let s_normalized = {
            let mut cow = s.expose_secret().into();
            Mnemonic::normalize_utf8_cow(&mut cow);
            cow
        };
        #[cfg(not(feature = "std"))]
        let s_normalized = s.expose_secret();

        let mut temp_words = [""; MAX_NB_WORDS + 1];
        let mut word_count = 0;
        for word in s_normalized.split_whitespace() {
            if word_count >= temp_words.len() {
                word_count += 1;
                break;
            }
            temp_words[word_count] = word;
            word_count += 1;
        }

        if is_invalid_word_count(word_count) {
            return Err(Bip39Error::BadWordCount(word_count));
        }

        let total_bits = word_count * 11;
        let checksum_len_bits = word_count / 3;
        let entropy_len_bits = total_bits - checksum_len_bits;
        let entropy_len_bytes = entropy_len_bits / 8;

        let mut indicators = [EOF; MAX_NB_WORDS];
        let mut bits = [false; MAX_TOTAL_BITS];

        for i in 0..word_count {
            let word_str = temp_words[i];
            match lang_words.iter().position(|&w| w == word_str) {
                Some(idx) => {
                    let idx_u16 = idx as u16;
                    indicators[i] = idx_u16;
                    for j in 0..11 {
                        bits[i * 11 + j] = (idx_u16 >> (10 - j)) & 1 == 1;
                    }
                }
                None => return Err(Bip39Error::UnknownWord(i)),
            }
        }

        let mut entropy = [0u8; MAX_ENTROPY_BYTES_LOCAL];
        for i in 0..entropy_len_bytes {
            for j in 0..8 {
                if bits[i * 8 + j] {
                    entropy[i] |= 1 << (7 - j);
                }
            }
        }

        let hash = Sha256::digest(&entropy[0..entropy_len_bytes]);
        entropy.zeroize();

        let mnemonic_checksum_bits = &bits[entropy_len_bits..total_bits];

        for i in 0..checksum_len_bits {
            let expected_bit = (hash[i / 8] >> (7 - (i % 8))) & 1 == 1;
            if mnemonic_checksum_bits[i] != expected_bit {
                return Err(Bip39Error::InvalidChecksum);
            }
        }

        Ok(Mnemonic {
            lang_words,
            indicators,
            word_count,
        })
    }

    pub fn parse_str_without_checksum(
        lang_words: &'a [&'a str; MAX_WORDS_DICT],
        s: &SecretString,
    ) -> Result<Self, Bip39Error> {
        #[cfg(feature = "std")]
        let s_normalized = {
            let mut cow = s.expose_secret().into();
            Mnemonic::normalize_utf8_cow(&mut cow);
            cow
        };
        #[cfg(not(feature = "std"))]
        let s_normalized = s.expose_secret();

        let mut temp_words = [""; MAX_NB_WORDS + 1];
        let mut word_count = 0;
        for word in s_normalized.split_whitespace() {
            if word_count >= temp_words.len() {
                word_count += 1;
                break;
            }
            temp_words[word_count] = word;
            word_count += 1;
        }

        if is_invalid_word_count(word_count) {
            return Err(Bip39Error::BadWordCount(word_count));
        }

        let mut indicators = [EOF; MAX_NB_WORDS];

        for i in 0..word_count {
            let word_str = temp_words[i];
            match lang_words.iter().position(|&w| w == word_str) {
                Some(idx) => {
                    indicators[i] = idx as u16;
                }
                None => return Err(Bip39Error::UnknownWord(i)),
            }
        }

        Ok(Mnemonic {
            lang_words,
            indicators,
            word_count,
        })
    }

    pub fn to_entropy(&'a self) -> SecretSlice<u8> {
        let entropy_bytes_len = (self.word_count / 3) * 4;
        let bytes: Vec<u8> = EntropyIter {
            mnemonic: self,
            word_idx: 0,
            bits: 0,
            bit_count: 0,
            bytes_produced: 0,
            bytes_to_produce: entropy_bytes_len,
        }
        .collect();
        SecretSlice::from(bytes)
    }

    pub fn from_entropy(
        lang_words: &'a [&'a str; MAX_WORDS_DICT],
        entropy: &[u8],
    ) -> Result<Self, Bip39Error> {
        const MAX_ENTROPY_BITS: usize = 256;
        const MIN_ENTROPY_BITS: usize = 128;
        const MAX_CHECKSUM_BITS: usize = 8;

        let nb_bytes = entropy.len();
        let nb_bits = nb_bytes * 8;

        if nb_bits % 32 != 0 {
            return Err(Bip39Error::BadEntropyBitCount(nb_bits));
        }
        if nb_bits < MIN_ENTROPY_BITS || nb_bits > MAX_ENTROPY_BITS {
            return Err(Bip39Error::BadEntropyBitCount(nb_bits));
        }

        let check = Sha256::digest(entropy);
        let cs_bits = nb_bits / 32;

        let mut bits = [false; MAX_ENTROPY_BITS + MAX_CHECKSUM_BITS];

        for i in 0..nb_bytes {
            for j in 0..8 {
                bits[i * 8 + j] = (entropy[i] & (1 << (7 - j))) != 0;
            }
        }

        for i in 0..cs_bits {
            bits[nb_bits + i] = (check[i / 8] & (1 << (7 - (i % 8)))) > 0;
        }

        let total_bits = nb_bits + cs_bits;
        let word_count = total_bits / 11;

        let mut indicators = [EOF; MAX_NB_WORDS];
        for i in 0..word_count {
            let mut idx = 0u16;
            for j in 0..11 {
                if bits[i * 11 + j] {
                    idx |= 1 << (10 - j);
                }
            }
            indicators[i] = idx;
        }

        Ok(Mnemonic {
            lang_words,
            indicators,
            word_count,
        })
    }

    pub fn generate<R: Rng>(
        rng: &mut R,
        lang_words: &'a [&'a str; MAX_WORDS_DICT],
        word_count: usize,
    ) -> Result<Self, Bip39Error> {
        if is_invalid_word_count(word_count) {
            return Err(Bip39Error::BadWordCount(word_count));
        }

        let entropy_bytes = (word_count / 3) * 4;
        let mut entropy = [0u8; (MAX_NB_WORDS / 3) * 4];

        Rng::fill_bytes(rng, &mut entropy[0..entropy_bytes]);

        let result = Mnemonic::from_entropy(lang_words, &entropy[0..entropy_bytes]);
        entropy.zeroize();
        result
    }

    pub fn checksum(&self) -> u8 {
        let last_word = self.indicators[self.word_count - 1];
        let mask = 0xFF >> (8 - self.word_count / 3);
        last_word as u8 & mask
    }
}

#[cfg(test)]
mod tests_mnemonic {
    use super::*;
    use hex;
    use rand::{RngCore, SeedableRng};
    use secrecy::ExposeSecret;

    impl<T: RngCore> crate::rng::Rng for T {
        fn fill_bytes(&mut self, dest: &mut [u8]) {
            RngCore::fill_bytes(self, dest);
        }
    }

    const JA_WORDS: [&str; 2048] = [
        "あいこくしん",
        "あいさつ",
        "あいだ",
        "あおぞら",
        "あかちゃん",
        "あきる",
        "あけがた",
        "あける",
        "あこがれる",
        "あさい",
        "あさひ",
        "あしあと",
        "あじわう",
        "あずかる",
        "あずき",
        "あそぶ",
        "あたえる",
        "あたためる",
        "あたりまえ",
        "あたる",
        "あつい",
        "あつかう",
        "あっしゅく",
        "あつまり",
        "あつめる",
        "あてな",
        "あてはまる",
        "あひる",
        "あぶら",
        "あぶる",
        "あふれる",
        "あまい",
        "あまど",
        "あまやかす",
        "あまり",
        "あみもの",
        "あめりか",
        "あやまる",
        "あゆむ",
        "あらいぐま",
        "あらし",
        "あらすじ",
        "あらためる",
        "あらゆる",
        "あらわす",
        "ありがとう",
        "あわせる",
        "あわてる",
        "あんい",
        "あんがい",
        "あんこ",
        "あんぜん",
        "あんてい",
        "あんない",
        "あんまり",
        "いいだす",
        "いおん",
        "いがい",
        "いがく",
        "いきおい",
        "いきなり",
        "いきもの",
        "いきる",
        "いくじ",
        "いくぶん",
        "いけばな",
        "いけん",
        "いこう",
        "いこく",
        "いこつ",
        "いさましい",
        "いさん",
        "いしき",
        "いじゅう",
        "いじょう",
        "いじわる",
        "いずみ",
        "いずれ",
        "いせい",
        "いせえび",
        "いせかい",
        "いせき",
        "いぜん",
        "いそうろう",
        "いそがしい",
        "いだい",
        "いだく",
        "いたずら",
        "いたみ",
        "いたりあ",
        "いちおう",
        "いちじ",
        "いちど",
        "いちば",
        "いちぶ",
        "いちりゅう",
        "いつか",
        "いっしゅん",
        "いっせい",
        "いっそう",
        "いったん",
        "いっち",
        "いってい",
        "いっぽう",
        "いてざ",
        "いてん",
        "いどう",
        "いとこ",
        "いない",
        "いなか",
        "いねむり",
        "いのち",
        "いのる",
        "いはつ",
        "いばる",
        "いはん",
        "いびき",
        "いひん",
        "いふく",
        "いへん",
        "いほう",
        "いみん",
        "いもうと",
        "いもたれ",
        "いもり",
        "いやがる",
        "いやす",
        "いよかん",
        "いよく",
        "いらい",
        "いらすと",
        "いりぐち",
        "いりょう",
        "いれい",
        "いれもの",
        "いれる",
        "いろえんぴつ",
        "いわい",
        "いわう",
        "いわかん",
        "いわば",
        "いわゆる",
        "いんげんまめ",
        "いんさつ",
        "いんしょう",
        "いんよう",
        "うえき",
        "うえる",
        "うおざ",
        "うがい",
        "うかぶ",
        "うかべる",
        "うきわ",
        "うくらいな",
        "うくれれ",
        "うけたまわる",
        "うけつけ",
        "うけとる",
        "うけもつ",
        "うける",
        "うごかす",
        "うごく",
        "うこん",
        "うさぎ",
        "うしなう",
        "うしろがみ",
        "うすい",
        "うすぎ",
        "うすぐらい",
        "うすめる",
        "うせつ",
        "うちあわせ",
        "うちがわ",
        "うちき",
        "うちゅう",
        "うっかり",
        "うつくしい",
        "うったえる",
        "うつる",
        "うどん",
        "うなぎ",
        "うなじ",
        "うなずく",
        "うなる",
        "うねる",
        "うのう",
        "うぶげ",
        "うぶごえ",
        "うまれる",
        "うめる",
        "うもう",
        "うやまう",
        "うよく",
        "うらがえす",
        "うらぐち",
        "うらない",
        "うりあげ",
        "うりきれ",
        "うるさい",
        "うれしい",
        "うれゆき",
        "うれる",
        "うろこ",
        "うわき",
        "うわさ",
        "うんこう",
        "うんちん",
        "うんてん",
        "うんどう",
        "えいえん",
        "えいが",
        "えいきょう",
        "えいご",
        "えいせい",
        "えいぶん",
        "えいよう",
        "えいわ",
        "えおり",
        "えがお",
        "えがく",
        "えきたい",
        "えくせる",
        "えしゃく",
        "えすて",
        "えつらん",
        "えのぐ",
        "えほうまき",
        "えほん",
        "えまき",
        "えもじ",
        "えもの",
        "えらい",
        "えらぶ",
        "えりあ",
        "えんえん",
        "えんかい",
        "えんぎ",
        "えんげき",
        "えんしゅう",
        "えんぜつ",
        "えんそく",
        "えんちょう",
        "えんとつ",
        "おいかける",
        "おいこす",
        "おいしい",
        "おいつく",
        "おうえん",
        "おうさま",
        "おうじ",
        "おうせつ",
        "おうたい",
        "おうふく",
        "おうべい",
        "おうよう",
        "おえる",
        "おおい",
        "おおう",
        "おおどおり",
        "おおや",
        "おおよそ",
        "おかえり",
        "おかず",
        "おがむ",
        "おかわり",
        "おぎなう",
        "おきる",
        "おくさま",
        "おくじょう",
        "おくりがな",
        "おくる",
        "おくれる",
        "おこす",
        "おこなう",
        "おこる",
        "おさえる",
        "おさない",
        "おさめる",
        "おしいれ",
        "おしえる",
        "おじぎ",
        "おじさん",
        "おしゃれ",
        "おそらく",
        "おそわる",
        "おたがい",
        "おたく",
        "おだやか",
        "おちつく",
        "おっと",
        "おつり",
        "おでかけ",
        "おとしもの",
        "おとなしい",
        "おどり",
        "おどろかす",
        "おばさん",
        "おまいり",
        "おめでとう",
        "おもいで",
        "おもう",
        "おもたい",
        "おもちゃ",
        "おやつ",
        "おやゆび",
        "およぼす",
        "おらんだ",
        "おろす",
        "おんがく",
        "おんけい",
        "おんしゃ",
        "おんせん",
        "おんだん",
        "おんちゅう",
        "おんどけい",
        "かあつ",
        "かいが",
        "がいき",
        "がいけん",
        "がいこう",
        "かいさつ",
        "かいしゃ",
        "かいすいよく",
        "かいぜん",
        "かいぞうど",
        "かいつう",
        "かいてん",
        "かいとう",
        "かいふく",
        "がいへき",
        "かいほう",
        "かいよう",
        "がいらい",
        "かいわ",
        "かえる",
        "かおり",
        "かかえる",
        "かがく",
        "かがし",
        "かがみ",
        "かくご",
        "かくとく",
        "かざる",
        "がぞう",
        "かたい",
        "かたち",
        "がちょう",
        "がっきゅう",
        "がっこう",
        "がっさん",
        "がっしょう",
        "かなざわし",
        "かのう",
        "がはく",
        "かぶか",
        "かほう",
        "かほご",
        "かまう",
        "かまぼこ",
        "かめれおん",
        "かゆい",
        "かようび",
        "からい",
        "かるい",
        "かろう",
        "かわく",
        "かわら",
        "がんか",
        "かんけい",
        "かんこう",
        "かんしゃ",
        "かんそう",
        "かんたん",
        "かんち",
        "がんばる",
        "きあい",
        "きあつ",
        "きいろ",
        "ぎいん",
        "きうい",
        "きうん",
        "きえる",
        "きおう",
        "きおく",
        "きおち",
        "きおん",
        "きかい",
        "きかく",
        "きかんしゃ",
        "ききて",
        "きくばり",
        "きくらげ",
        "きけんせい",
        "きこう",
        "きこえる",
        "きこく",
        "きさい",
        "きさく",
        "きさま",
        "きさらぎ",
        "ぎじかがく",
        "ぎしき",
        "ぎじたいけん",
        "ぎじにってい",
        "ぎじゅつしゃ",
        "きすう",
        "きせい",
        "きせき",
        "きせつ",
        "きそう",
        "きぞく",
        "きぞん",
        "きたえる",
        "きちょう",
        "きつえん",
        "ぎっちり",
        "きつつき",
        "きつね",
        "きてい",
        "きどう",
        "きどく",
        "きない",
        "きなが",
        "きなこ",
        "きぬごし",
        "きねん",
        "きのう",
        "きのした",
        "きはく",
        "きびしい",
        "きひん",
        "きふく",
        "きぶん",
        "きぼう",
        "きほん",
        "きまる",
        "きみつ",
        "きむずかしい",
        "きめる",
        "きもだめし",
        "きもち",
        "きもの",
        "きゃく",
        "きやく",
        "ぎゅうにく",
        "きよう",
        "きょうりゅう",
        "きらい",
        "きらく",
        "きりん",
        "きれい",
        "きれつ",
        "きろく",
        "ぎろん",
        "きわめる",
        "ぎんいろ",
        "きんかくじ",
        "きんじょ",
        "きんようび",
        "ぐあい",
        "くいず",
        "くうかん",
        "くうき",
        "くうぐん",
        "くうこう",
        "ぐうせい",
        "くうそう",
        "ぐうたら",
        "くうふく",
        "くうぼ",
        "くかん",
        "くきょう",
        "くげん",
        "ぐこう",
        "くさい",
        "くさき",
        "くさばな",
        "くさる",
        "くしゃみ",
        "くしょう",
        "くすのき",
        "くすりゆび",
        "くせげ",
        "くせん",
        "ぐたいてき",
        "くださる",
        "くたびれる",
        "くちこみ",
        "くちさき",
        "くつした",
        "ぐっすり",
        "くつろぐ",
        "くとうてん",
        "くどく",
        "くなん",
        "くねくね",
        "くのう",
        "くふう",
        "くみあわせ",
        "くみたてる",
        "くめる",
        "くやくしょ",
        "くらす",
        "くらべる",
        "くるま",
        "くれる",
        "くろう",
        "くわしい",
        "ぐんかん",
        "ぐんしょく",
        "ぐんたい",
        "ぐんて",
        "けあな",
        "けいかく",
        "けいけん",
        "けいこ",
        "けいさつ",
        "げいじゅつ",
        "けいたい",
        "げいのうじん",
        "けいれき",
        "けいろ",
        "けおとす",
        "けおりもの",
        "げきか",
        "げきげん",
        "げきだん",
        "げきちん",
        "げきとつ",
        "げきは",
        "げきやく",
        "げこう",
        "げこくじょう",
        "げざい",
        "けさき",
        "げざん",
        "けしき",
        "けしごむ",
        "けしょう",
        "げすと",
        "けたば",
        "けちゃっぷ",
        "けちらす",
        "けつあつ",
        "けつい",
        "けつえき",
        "けっこん",
        "けつじょ",
        "けっせき",
        "けってい",
        "けつまつ",
        "げつようび",
        "げつれい",
        "けつろん",
        "げどく",
        "けとばす",
        "けとる",
        "けなげ",
        "けなす",
        "けなみ",
        "けぬき",
        "げねつ",
        "けねん",
        "けはい",
        "げひん",
        "けぶかい",
        "げぼく",
        "けまり",
        "けみかる",
        "けむし",
        "けむり",
        "けもの",
        "けらい",
        "けろけろ",
        "けわしい",
        "けんい",
        "けんえつ",
        "けんお",
        "けんか",
        "げんき",
        "けんげん",
        "けんこう",
        "けんさく",
        "けんしゅう",
        "けんすう",
        "げんそう",
        "けんちく",
        "けんてい",
        "けんとう",
        "けんない",
        "けんにん",
        "げんぶつ",
        "けんま",
        "けんみん",
        "けんめい",
        "けんらん",
        "けんり",
        "こあくま",
        "こいぬ",
        "こいびと",
        "ごうい",
        "こうえん",
        "こうおん",
        "こうかん",
        "ごうきゅう",
        "ごうけい",
        "こうこう",
        "こうさい",
        "こうじ",
        "こうすい",
        "ごうせい",
        "こうそく",
        "こうたい",
        "こうちゃ",
        "こうつう",
        "こうてい",
        "こうどう",
        "こうない",
        "こうはい",
        "ごうほう",
        "ごうまん",
        "こうもく",
        "こうりつ",
        "こえる",
        "こおり",
        "ごかい",
        "ごがつ",
        "ごかん",
        "こくご",
        "こくさい",
        "こくとう",
        "こくない",
        "こくはく",
        "こぐま",
        "こけい",
        "こける",
        "ここのか",
        "こころ",
        "こさめ",
        "こしつ",
        "こすう",
        "こせい",
        "こせき",
        "こぜん",
        "こそだて",
        "こたい",
        "こたえる",
        "こたつ",
        "こちょう",
        "こっか",
        "こつこつ",
        "こつばん",
        "こつぶ",
        "こてい",
        "こてん",
        "ことがら",
        "ことし",
        "ことば",
        "ことり",
        "こなごな",
        "こねこね",
        "このまま",
        "このみ",
        "このよ",
        "ごはん",
        "こひつじ",
        "こふう",
        "こふん",
        "こぼれる",
        "ごまあぶら",
        "こまかい",
        "ごますり",
        "こまつな",
        "こまる",
        "こむぎこ",
        "こもじ",
        "こもち",
        "こもの",
        "こもん",
        "こやく",
        "こやま",
        "こゆう",
        "こゆび",
        "こよい",
        "こよう",
        "こりる",
        "これくしょん",
        "ころっけ",
        "こわもて",
        "こわれる",
        "こんいん",
        "こんかい",
        "こんき",
        "こんしゅう",
        "こんすい",
        "こんだて",
        "こんとん",
        "こんなん",
        "こんびに",
        "こんぽん",
        "こんまけ",
        "こんや",
        "こんれい",
        "こんわく",
        "ざいえき",
        "さいかい",
        "さいきん",
        "ざいげん",
        "ざいこ",
        "さいしょ",
        "さいせい",
        "ざいたく",
        "ざいちゅう",
        "さいてき",
        "ざいりょう",
        "さうな",
        "さかいし",
        "さがす",
        "さかな",
        "さかみち",
        "さがる",
        "さぎょう",
        "さくし",
        "さくひん",
        "さくら",
        "さこく",
        "さこつ",
        "さずかる",
        "ざせき",
        "さたん",
        "さつえい",
        "ざつおん",
        "ざっか",
        "ざつがく",
        "さっきょく",
        "ざっし",
        "さつじん",
        "ざっそう",
        "さつたば",
        "さつまいも",
        "さてい",
        "さといも",
        "さとう",
        "さとおや",
        "さとし",
        "さとる",
        "さのう",
        "さばく",
        "さびしい",
        "さべつ",
        "さほう",
        "さほど",
        "さます",
        "さみしい",
        "さみだれ",
        "さむけ",
        "さめる",
        "さやえんどう",
        "さゆう",
        "さよう",
        "さよく",
        "さらだ",
        "ざるそば",
        "さわやか",
        "さわる",
        "さんいん",
        "さんか",
        "さんきゃく",
        "さんこう",
        "さんさい",
        "ざんしょ",
        "さんすう",
        "さんせい",
        "さんそ",
        "さんち",
        "さんま",
        "さんみ",
        "さんらん",
        "しあい",
        "しあげ",
        "しあさって",
        "しあわせ",
        "しいく",
        "しいん",
        "しうち",
        "しえい",
        "しおけ",
        "しかい",
        "しかく",
        "じかん",
        "しごと",
        "しすう",
        "じだい",
        "したうけ",
        "したぎ",
        "したて",
        "したみ",
        "しちょう",
        "しちりん",
        "しっかり",
        "しつじ",
        "しつもん",
        "してい",
        "してき",
        "してつ",
        "じてん",
        "じどう",
        "しなぎれ",
        "しなもの",
        "しなん",
        "しねま",
        "しねん",
        "しのぐ",
        "しのぶ",
        "しはい",
        "しばかり",
        "しはつ",
        "しはらい",
        "しはん",
        "しひょう",
        "しふく",
        "じぶん",
        "しへい",
        "しほう",
        "しほん",
        "しまう",
        "しまる",
        "しみん",
        "しむける",
        "じむしょ",
        "しめい",
        "しめる",
        "しもん",
        "しゃいん",
        "しゃうん",
        "しゃおん",
        "じゃがいも",
        "しやくしょ",
        "しゃくほう",
        "しゃけん",
        "しゃこ",
        "しゃざい",
        "しゃしん",
        "しゃせん",
        "しゃそう",
        "しゃたい",
        "しゃちょう",
        "しゃっきん",
        "じゃま",
        "しゃりん",
        "しゃれい",
        "じゆう",
        "じゅうしょ",
        "しゅくはく",
        "じゅしん",
        "しゅっせき",
        "しゅみ",
        "しゅらば",
        "じゅんばん",
        "しょうかい",
        "しょくたく",
        "しょっけん",
        "しょどう",
        "しょもつ",
        "しらせる",
        "しらべる",
        "しんか",
        "しんこう",
        "じんじゃ",
        "しんせいじ",
        "しんちく",
        "しんりん",
        "すあげ",
        "すあし",
        "すあな",
        "ずあん",
        "すいえい",
        "すいか",
        "すいとう",
        "ずいぶん",
        "すいようび",
        "すうがく",
        "すうじつ",
        "すうせん",
        "すおどり",
        "すきま",
        "すくう",
        "すくない",
        "すける",
        "すごい",
        "すこし",
        "ずさん",
        "すずしい",
        "すすむ",
        "すすめる",
        "すっかり",
        "ずっしり",
        "ずっと",
        "すてき",
        "すてる",
        "すねる",
        "すのこ",
        "すはだ",
        "すばらしい",
        "ずひょう",
        "ずぶぬれ",
        "すぶり",
        "すふれ",
        "すべて",
        "すべる",
        "ずほう",
        "すぼん",
        "すまい",
        "すめし",
        "すもう",
        "すやき",
        "すらすら",
        "するめ",
        "すれちがう",
        "すろっと",
        "すわる",
        "すんぜん",
        "すんぽう",
        "せあぶら",
        "せいかつ",
        "せいげん",
        "せいじ",
        "せいよう",
        "せおう",
        "せかいかん",
        "せきにん",
        "せきむ",
        "せきゆ",
        "せきらんうん",
        "せけん",
        "せこう",
        "せすじ",
        "せたい",
        "せたけ",
        "せっかく",
        "せっきゃく",
        "ぜっく",
        "せっけん",
        "せっこつ",
        "せっさたくま",
        "せつぞく",
        "せつだん",
        "せつでん",
        "せっぱん",
        "せつび",
        "せつぶん",
        "せつめい",
        "せつりつ",
        "せなか",
        "せのび",
        "せはば",
        "せびろ",
        "せぼね",
        "せまい",
        "せまる",
        "せめる",
        "せもたれ",
        "せりふ",
        "ぜんあく",
        "せんい",
        "せんえい",
        "せんか",
        "せんきょ",
        "せんく",
        "せんげん",
        "ぜんご",
        "せんさい",
        "せんしゅ",
        "せんすい",
        "せんせい",
        "せんぞ",
        "せんたく",
        "せんちょう",
        "せんてい",
        "せんとう",
        "せんぬき",
        "せんねん",
        "せんぱい",
        "ぜんぶ",
        "ぜんぽう",
        "せんむ",
        "せんめんじょ",
        "せんもん",
        "せんやく",
        "せんゆう",
        "せんよう",
        "ぜんら",
        "ぜんりゃく",
        "せんれい",
        "せんろ",
        "そあく",
        "そいとげる",
        "そいね",
        "そうがんきょう",
        "そうき",
        "そうご",
        "そうしん",
        "そうだん",
        "そうなん",
        "そうび",
        "そうめん",
        "そうり",
        "そえもの",
        "そえん",
        "そがい",
        "そげき",
        "そこう",
        "そこそこ",
        "そざい",
        "そしな",
        "そせい",
        "そせん",
        "そそぐ",
        "そだてる",
        "そつう",
        "そつえん",
        "そっかん",
        "そつぎょう",
        "そっけつ",
        "そっこう",
        "そっせん",
        "そっと",
        "そとがわ",
        "そとづら",
        "そなえる",
        "そなた",
        "そふぼ",
        "そぼく",
        "そぼろ",
        "そまつ",
        "そまる",
        "そむく",
        "そむりえ",
        "そめる",
        "そもそも",
        "そよかぜ",
        "そらまめ",
        "そろう",
        "そんかい",
        "そんけい",
        "そんざい",
        "そんしつ",
        "そんぞく",
        "そんちょう",
        "ぞんび",
        "ぞんぶん",
        "そんみん",
        "たあい",
        "たいいん",
        "たいうん",
        "たいえき",
        "たいおう",
        "だいがく",
        "たいき",
        "たいぐう",
        "たいけん",
        "たいこ",
        "たいざい",
        "だいじょうぶ",
        "だいすき",
        "たいせつ",
        "たいそう",
        "だいたい",
        "たいちょう",
        "たいてい",
        "だいどころ",
        "たいない",
        "たいねつ",
        "たいのう",
        "たいはん",
        "だいひょう",
        "たいふう",
        "たいへん",
        "たいほ",
        "たいまつばな",
        "たいみんぐ",
        "たいむ",
        "たいめん",
        "たいやき",
        "たいよう",
        "たいら",
        "たいりょく",
        "たいる",
        "たいわん",
        "たうえ",
        "たえる",
        "たおす",
        "たおる",
        "たおれる",
        "たかい",
        "たかね",
        "たきび",
        "たくさん",
        "たこく",
        "たこやき",
        "たさい",
        "たしざん",
        "だじゃれ",
        "たすける",
        "たずさわる",
        "たそがれ",
        "たたかう",
        "たたく",
        "ただしい",
        "たたみ",
        "たちばな",
        "だっかい",
        "だっきゃく",
        "だっこ",
        "だっしゅつ",
        "だったい",
        "たてる",
        "たとえる",
        "たなばた",
        "たにん",
        "たぬき",
        "たのしみ",
        "たはつ",
        "たぶん",
        "たべる",
        "たぼう",
        "たまご",
        "たまる",
        "だむる",
        "ためいき",
        "ためす",
        "ためる",
        "たもつ",
        "たやすい",
        "たよる",
        "たらす",
        "たりきほんがん",
        "たりょう",
        "たりる",
        "たると",
        "たれる",
        "たれんと",
        "たろっと",
        "たわむれる",
        "だんあつ",
        "たんい",
        "たんおん",
        "たんか",
        "たんき",
        "たんけん",
        "たんご",
        "たんさん",
        "たんじょうび",
        "だんせい",
        "たんそく",
        "たんたい",
        "だんち",
        "たんてい",
        "たんとう",
        "だんな",
        "たんにん",
        "だんねつ",
        "たんのう",
        "たんぴん",
        "だんぼう",
        "たんまつ",
        "たんめい",
        "だんれつ",
        "だんろ",
        "だんわ",
        "ちあい",
        "ちあん",
        "ちいき",
        "ちいさい",
        "ちえん",
        "ちかい",
        "ちから",
        "ちきゅう",
        "ちきん",
        "ちけいず",
        "ちけん",
        "ちこく",
        "ちさい",
        "ちしき",
        "ちしりょう",
        "ちせい",
        "ちそう",
        "ちたい",
        "ちたん",
        "ちちおや",
        "ちつじょ",
        "ちてき",
        "ちてん",
        "ちぬき",
        "ちぬり",
        "ちのう",
        "ちひょう",
        "ちへいせん",
        "ちほう",
        "ちまた",
        "ちみつ",
        "ちみどろ",
        "ちめいど",
        "ちゃんこなべ",
        "ちゅうい",
        "ちゆりょく",
        "ちょうし",
        "ちょさくけん",
        "ちらし",
        "ちらみ",
        "ちりがみ",
        "ちりょう",
        "ちるど",
        "ちわわ",
        "ちんたい",
        "ちんもく",
        "ついか",
        "ついたち",
        "つうか",
        "つうじょう",
        "つうはん",
        "つうわ",
        "つかう",
        "つかれる",
        "つくね",
        "つくる",
        "つけね",
        "つける",
        "つごう",
        "つたえる",
        "つづく",
        "つつじ",
        "つつむ",
        "つとめる",
        "つながる",
        "つなみ",
        "つねづね",
        "つのる",
        "つぶす",
        "つまらない",
        "つまる",
        "つみき",
        "つめたい",
        "つもり",
        "つもる",
        "つよい",
        "つるぼ",
        "つるみく",
        "つわもの",
        "つわり",
        "てあし",
        "てあて",
        "てあみ",
        "ていおん",
        "ていか",
        "ていき",
        "ていけい",
        "ていこく",
        "ていさつ",
        "ていし",
        "ていせい",
        "ていたい",
        "ていど",
        "ていねい",
        "ていひょう",
        "ていへん",
        "ていぼう",
        "てうち",
        "ておくれ",
        "てきとう",
        "てくび",
        "でこぼこ",
        "てさぎょう",
        "てさげ",
        "てすり",
        "てそう",
        "てちがい",
        "てちょう",
        "てつがく",
        "てつづき",
        "でっぱ",
        "てつぼう",
        "てつや",
        "でぬかえ",
        "てぬき",
        "てぬぐい",
        "てのひら",
        "てはい",
        "てぶくろ",
        "てふだ",
        "てほどき",
        "てほん",
        "てまえ",
        "てまきずし",
        "てみじか",
        "てみやげ",
        "てらす",
        "てれび",
        "てわけ",
        "てわたし",
        "でんあつ",
        "てんいん",
        "てんかい",
        "てんき",
        "てんぐ",
        "てんけん",
        "てんごく",
        "てんさい",
        "てんし",
        "てんすう",
        "でんち",
        "てんてき",
        "てんとう",
        "てんない",
        "てんぷら",
        "てんぼうだい",
        "てんめつ",
        "てんらんかい",
        "でんりょく",
        "でんわ",
        "どあい",
        "といれ",
        "どうかん",
        "とうきゅう",
        "どうぐ",
        "とうし",
        "とうむぎ",
        "とおい",
        "とおか",
        "とおく",
        "とおす",
        "とおる",
        "とかい",
        "とかす",
        "ときおり",
        "ときどき",
        "とくい",
        "とくしゅう",
        "とくてん",
        "とくに",
        "とくべつ",
        "とけい",
        "とける",
        "とこや",
        "とさか",
        "としょかん",
        "とそう",
        "とたん",
        "とちゅう",
        "とっきゅう",
        "とっくん",
        "とつぜん",
        "とつにゅう",
        "とどける",
        "ととのえる",
        "とない",
        "となえる",
        "となり",
        "とのさま",
        "とばす",
        "どぶがわ",
        "とほう",
        "とまる",
        "とめる",
        "ともだち",
        "ともる",
        "どようび",
        "とらえる",
        "とんかつ",
        "どんぶり",
        "ないかく",
        "ないこう",
        "ないしょ",
        "ないす",
        "ないせん",
        "ないそう",
        "なおす",
        "ながい",
        "なくす",
        "なげる",
        "なこうど",
        "なさけ",
        "なたでここ",
        "なっとう",
        "なつやすみ",
        "ななおし",
        "なにごと",
        "なにもの",
        "なにわ",
        "なのか",
        "なふだ",
        "なまいき",
        "なまえ",
        "なまみ",
        "なみだ",
        "なめらか",
        "なめる",
        "なやむ",
        "ならう",
        "ならび",
        "ならぶ",
        "なれる",
        "なわとび",
        "なわばり",
        "にあう",
        "にいがた",
        "にうけ",
        "におい",
        "にかい",
        "にがて",
        "にきび",
        "にくしみ",
        "にくまん",
        "にげる",
        "にさんかたんそ",
        "にしき",
        "にせもの",
        "にちじょう",
        "にちようび",
        "にっか",
        "にっき",
        "にっけい",
        "にっこう",
        "にっさん",
        "にっしょく",
        "にっすう",
        "にっせき",
        "にってい",
        "になう",
        "にほん",
        "にまめ",
        "にもつ",
        "にやり",
        "にゅういん",
        "にりんしゃ",
        "にわとり",
        "にんい",
        "にんか",
        "にんき",
        "にんげん",
        "にんしき",
        "にんずう",
        "にんそう",
        "にんたい",
        "にんち",
        "にんてい",
        "にんにく",
        "にんぷ",
        "にんまり",
        "にんむ",
        "にんめい",
        "にんよう",
        "ぬいくぎ",
        "ぬかす",
        "ぬぐいとる",
        "ぬぐう",
        "ぬくもり",
        "ぬすむ",
        "ぬまえび",
        "ぬめり",
        "ぬらす",
        "ぬんちゃく",
        "ねあげ",
        "ねいき",
        "ねいる",
        "ねいろ",
        "ねぐせ",
        "ねくたい",
        "ねくら",
        "ねこぜ",
        "ねこむ",
        "ねさげ",
        "ねすごす",
        "ねそべる",
        "ねだん",
        "ねつい",
        "ねっしん",
        "ねつぞう",
        "ねったいぎょ",
        "ねぶそく",
        "ねふだ",
        "ねぼう",
        "ねほりはほり",
        "ねまき",
        "ねまわし",
        "ねみみ",
        "ねむい",
        "ねむたい",
        "ねもと",
        "ねらう",
        "ねわざ",
        "ねんいり",
        "ねんおし",
        "ねんかん",
        "ねんきん",
        "ねんぐ",
        "ねんざ",
        "ねんし",
        "ねんちゃく",
        "ねんど",
        "ねんぴ",
        "ねんぶつ",
        "ねんまつ",
        "ねんりょう",
        "ねんれい",
        "のいず",
        "のおづま",
        "のがす",
        "のきなみ",
        "のこぎり",
        "のこす",
        "のこる",
        "のせる",
        "のぞく",
        "のぞむ",
        "のたまう",
        "のちほど",
        "のっく",
        "のばす",
        "のはら",
        "のべる",
        "のぼる",
        "のみもの",
        "のやま",
        "のらいぬ",
        "のらねこ",
        "のりもの",
        "のりゆき",
        "のれん",
        "のんき",
        "ばあい",
        "はあく",
        "ばあさん",
        "ばいか",
        "ばいく",
        "はいけん",
        "はいご",
        "はいしん",
        "はいすい",
        "はいせん",
        "はいそう",
        "はいち",
        "ばいばい",
        "はいれつ",
        "はえる",
        "はおる",
        "はかい",
        "ばかり",
        "はかる",
        "はくしゅ",
        "はけん",
        "はこぶ",
        "はさみ",
        "はさん",
        "はしご",
        "ばしょ",
        "はしる",
        "はせる",
        "ぱそこん",
        "はそん",
        "はたん",
        "はちみつ",
        "はつおん",
        "はっかく",
        "はづき",
        "はっきり",
        "はっくつ",
        "はっけん",
        "はっこう",
        "はっさん",
        "はっしん",
        "はったつ",
        "はっちゅう",
        "はってん",
        "はっぴょう",
        "はっぽう",
        "はなす",
        "はなび",
        "はにかむ",
        "はぶらし",
        "はみがき",
        "はむかう",
        "はめつ",
        "はやい",
        "はやし",
        "はらう",
        "はろうぃん",
        "はわい",
        "はんい",
        "はんえい",
        "はんおん",
        "はんかく",
        "はんきょう",
        "ばんぐみ",
        "はんこ",
        "はんしゃ",
        "はんすう",
        "はんだん",
        "ぱんち",
        "ぱんつ",
        "はんてい",
        "はんとし",
        "はんのう",
        "はんぱ",
        "はんぶん",
        "はんぺん",
        "はんぼうき",
        "はんめい",
        "はんらん",
        "はんろん",
        "ひいき",
        "ひうん",
        "ひえる",
        "ひかく",
        "ひかり",
        "ひかる",
        "ひかん",
        "ひくい",
        "ひけつ",
        "ひこうき",
        "ひこく",
        "ひさい",
        "ひさしぶり",
        "ひさん",
        "びじゅつかん",
        "ひしょ",
        "ひそか",
        "ひそむ",
        "ひたむき",
        "ひだり",
        "ひたる",
        "ひつぎ",
        "ひっこし",
        "ひっし",
        "ひつじゅひん",
        "ひっす",
        "ひつぜん",
        "ぴったり",
        "ぴっちり",
        "ひつよう",
        "ひてい",
        "ひとごみ",
        "ひなまつり",
        "ひなん",
        "ひねる",
        "ひはん",
        "ひびく",
        "ひひょう",
        "ひほう",
        "ひまわり",
        "ひまん",
        "ひみつ",
        "ひめい",
        "ひめじし",
        "ひやけ",
        "ひやす",
        "ひよう",
        "びょうき",
        "ひらがな",
        "ひらく",
        "ひりつ",
        "ひりょう",
        "ひるま",
        "ひるやすみ",
        "ひれい",
        "ひろい",
        "ひろう",
        "ひろき",
        "ひろゆき",
        "ひんかく",
        "ひんけつ",
        "ひんこん",
        "ひんしゅ",
        "ひんそう",
        "ぴんち",
        "ひんぱん",
        "びんぼう",
        "ふあん",
        "ふいうち",
        "ふうけい",
        "ふうせん",
        "ぷうたろう",
        "ふうとう",
        "ふうふ",
        "ふえる",
        "ふおん",
        "ふかい",
        "ふきん",
        "ふくざつ",
        "ふくぶくろ",
        "ふこう",
        "ふさい",
        "ふしぎ",
        "ふじみ",
        "ふすま",
        "ふせい",
        "ふせぐ",
        "ふそく",
        "ぶたにく",
        "ふたん",
        "ふちょう",
        "ふつう",
        "ふつか",
        "ふっかつ",
        "ふっき",
        "ふっこく",
        "ぶどう",
        "ふとる",
        "ふとん",
        "ふのう",
        "ふはい",
        "ふひょう",
        "ふへん",
        "ふまん",
        "ふみん",
        "ふめつ",
        "ふめん",
        "ふよう",
        "ふりこ",
        "ふりる",
        "ふるい",
        "ふんいき",
        "ぶんがく",
        "ぶんぐ",
        "ふんしつ",
        "ぶんせき",
        "ふんそう",
        "ぶんぽう",
        "へいあん",
        "へいおん",
        "へいがい",
        "へいき",
        "へいげん",
        "へいこう",
        "へいさ",
        "へいしゃ",
        "へいせつ",
        "へいそ",
        "へいたく",
        "へいてん",
        "へいねつ",
        "へいわ",
        "へきが",
        "へこむ",
        "べにいろ",
        "べにしょうが",
        "へらす",
        "へんかん",
        "べんきょう",
        "べんごし",
        "へんさい",
        "へんたい",
        "べんり",
        "ほあん",
        "ほいく",
        "ぼうぎょ",
        "ほうこく",
        "ほうそう",
        "ほうほう",
        "ほうもん",
        "ほうりつ",
        "ほえる",
        "ほおん",
        "ほかん",
        "ほきょう",
        "ぼきん",
        "ほくろ",
        "ほけつ",
        "ほけん",
        "ほこう",
        "ほこる",
        "ほしい",
        "ほしつ",
        "ほしゅ",
        "ほしょう",
        "ほせい",
        "ほそい",
        "ほそく",
        "ほたて",
        "ほたる",
        "ぽちぶくろ",
        "ほっきょく",
        "ほっさ",
        "ほったん",
        "ほとんど",
        "ほめる",
        "ほんい",
        "ほんき",
        "ほんけ",
        "ほんしつ",
        "ほんやく",
        "まいにち",
        "まかい",
        "まかせる",
        "まがる",
        "まける",
        "まこと",
        "まさつ",
        "まじめ",
        "ますく",
        "まぜる",
        "まつり",
        "まとめ",
        "まなぶ",
        "まぬけ",
        "まねく",
        "まほう",
        "まもる",
        "まゆげ",
        "まよう",
        "まろやか",
        "まわす",
        "まわり",
        "まわる",
        "まんが",
        "まんきつ",
        "まんぞく",
        "まんなか",
        "みいら",
        "みうち",
        "みえる",
        "みがく",
        "みかた",
        "みかん",
        "みけん",
        "みこん",
        "みじかい",
        "みすい",
        "みすえる",
        "みせる",
        "みっか",
        "みつかる",
        "みつける",
        "みてい",
        "みとめる",
        "みなと",
        "みなみかさい",
        "みねらる",
        "みのう",
        "みのがす",
        "みほん",
        "みもと",
        "みやげ",
        "みらい",
        "みりょく",
        "みわく",
        "みんか",
        "みんぞく",
        "むいか",
        "むえき",
        "むえん",
        "むかい",
        "むかう",
        "むかえ",
        "むかし",
        "むぎちゃ",
        "むける",
        "むげん",
        "むさぼる",
        "むしあつい",
        "むしば",
        "むじゅん",
        "むしろ",
        "むすう",
        "むすこ",
        "むすぶ",
        "むすめ",
        "むせる",
        "むせん",
        "むちゅう",
        "むなしい",
        "むのう",
        "むやみ",
        "むよう",
        "むらさき",
        "むりょう",
        "むろん",
        "めいあん",
        "めいうん",
        "めいえん",
        "めいかく",
        "めいきょく",
        "めいさい",
        "めいし",
        "めいそう",
        "めいぶつ",
        "めいれい",
        "めいわく",
        "めぐまれる",
        "めざす",
        "めした",
        "めずらしい",
        "めだつ",
        "めまい",
        "めやす",
        "めんきょ",
        "めんせき",
        "めんどう",
        "もうしあげる",
        "もうどうけん",
        "もえる",
        "もくし",
        "もくてき",
        "もくようび",
        "もちろん",
        "もどる",
        "もらう",
        "もんく",
        "もんだい",
        "やおや",
        "やける",
        "やさい",
        "やさしい",
        "やすい",
        "やすたろう",
        "やすみ",
        "やせる",
        "やそう",
        "やたい",
        "やちん",
        "やっと",
        "やっぱり",
        "やぶる",
        "やめる",
        "ややこしい",
        "やよい",
        "やわらかい",
        "ゆうき",
        "ゆうびんきょく",
        "ゆうべ",
        "ゆうめい",
        "ゆけつ",
        "ゆしゅつ",
        "ゆせん",
        "ゆそう",
        "ゆたか",
        "ゆちゃく",
        "ゆでる",
        "ゆにゅう",
        "ゆびわ",
        "ゆらい",
        "ゆれる",
        "ようい",
        "ようか",
        "ようきゅう",
        "ようじ",
        "ようす",
        "ようちえん",
        "よかぜ",
        "よかん",
        "よきん",
        "よくせい",
        "よくぼう",
        "よけい",
        "よごれる",
        "よさん",
        "よしゅう",
        "よそう",
        "よそく",
        "よっか",
        "よてい",
        "よどがわく",
        "よねつ",
        "よやく",
        "よゆう",
        "よろこぶ",
        "よろしい",
        "らいう",
        "らくがき",
        "らくご",
        "らくさつ",
        "らくだ",
        "らしんばん",
        "らせん",
        "らぞく",
        "らたい",
        "らっか",
        "られつ",
        "りえき",
        "りかい",
        "りきさく",
        "りきせつ",
        "りくぐん",
        "りくつ",
        "りけん",
        "りこう",
        "りせい",
        "りそう",
        "りそく",
        "りてん",
        "りねん",
        "りゆう",
        "りゅうがく",
        "りよう",
        "りょうり",
        "りょかん",
        "りょくちゃ",
        "りょこう",
        "りりく",
        "りれき",
        "りろん",
        "りんご",
        "るいけい",
        "るいさい",
        "るいじ",
        "るいせき",
        "るすばん",
        "るりがわら",
        "れいかん",
        "れいぎ",
        "れいせい",
        "れいぞうこ",
        "れいとう",
        "れいぼう",
        "れきし",
        "れきだい",
        "れんあい",
        "れんけい",
        "れんこん",
        "れんさい",
        "れんしゅう",
        "れんぞく",
        "れんらく",
        "ろうか",
        "ろうご",
        "ろうじん",
        "ろうそく",
        "ろくが",
        "ろこつ",
        "ろじうら",
        "ろしゅつ",
        "ろせん",
        "ろてん",
        "ろめん",
        "ろれつ",
        "ろんぎ",
        "ろんぱ",
        "ろんぶん",
        "ろんり",
        "わかす",
        "わかめ",
        "わかやま",
        "わかれる",
        "わしつ",
        "わじまし",
        "わすれもの",
        "わらう",
        "われる",
    ];

    const EN_WORDS: [&str; 2048] = [
        "abandon", "ability", "able", "about", "above", "absent", "absorb", "abstract", "absurd",
        "abuse", "access", "accident", "account", "accuse", "achieve", "acid", "acoustic",
        "acquire", "across", "act", "action", "actor", "actress", "actual", "adapt", "add",
        "addict", "address", "adjust", "admit", "adult", "advance", "advice", "aerobic", "affair",
        "afford", "afraid", "again", "age", "agent", "agree", "ahead", "aim", "air", "airport",
        "aisle", "alarm", "album", "alcohol", "alert", "alien", "all", "alley", "allow", "almost",
        "alone", "alpha", "already", "also", "alter", "always", "amateur", "amazing", "among",
        "amount", "amused", "analyst", "anchor", "ancient", "anger", "angle", "angry", "animal",
        "ankle", "announce", "annual", "another", "answer", "antenna", "antique", "anxiety", "any",
        "apart", "apology", "appear", "apple", "approve", "april", "arch", "arctic", "area",
        "arena", "argue", "arm", "armed", "armor", "army", "around", "arrange", "arrest", "arrive",
        "arrow", "art", "artefact", "artist", "artwork", "ask", "aspect", "assault", "asset",
        "assist", "assume", "asthma", "athlete", "atom", "attack", "attend", "attitude", "attract",
        "auction", "audit", "august", "aunt", "author", "auto", "autumn", "average", "avocado",
        "avoid", "awake", "aware", "away", "awesome", "awful", "awkward", "axis", "baby",
        "bachelor", "bacon", "badge", "bag", "balance", "balcony", "ball", "bamboo", "banana",
        "banner", "bar", "barely", "bargain", "barrel", "base", "basic", "basket", "battle",
        "beach", "bean", "beauty", "because", "become", "beef", "before", "begin", "behave",
        "behind", "believe", "below", "belt", "bench", "benefit", "best", "betray", "better",
        "between", "beyond", "bicycle", "bid", "bike", "bind", "biology", "bird", "birth",
        "bitter", "black", "blade", "blame", "blanket", "blast", "bleak", "bless", "blind",
        "blood", "blossom", "blouse", "blue", "blur", "blush", "board", "boat", "body", "boil",
        "bomb", "bone", "bonus", "book", "boost", "border", "boring", "borrow", "boss", "bottom",
        "bounce", "box", "boy", "bracket", "brain", "brand", "brass", "brave", "bread", "breeze",
        "brick", "bridge", "brief", "bright", "bring", "brisk", "broccoli", "broken", "bronze",
        "broom", "brother", "brown", "brush", "bubble", "buddy", "budget", "buffalo", "build",
        "bulb", "bulk", "bullet", "bundle", "bunker", "burden", "burger", "burst", "bus",
        "business", "busy", "butter", "buyer", "buzz", "cabbage", "cabin", "cable", "cactus",
        "cage", "cake", "call", "calm", "camera", "camp", "can", "canal", "cancel", "candy",
        "cannon", "canoe", "canvas", "canyon", "capable", "capital", "captain", "car", "carbon",
        "card", "cargo", "carpet", "carry", "cart", "case", "cash", "casino", "castle", "casual",
        "cat", "catalog", "catch", "category", "cattle", "caught", "cause", "caution", "cave",
        "ceiling", "celery", "cement", "census", "century", "cereal", "certain", "chair", "chalk",
        "champion", "change", "chaos", "chapter", "charge", "chase", "chat", "cheap", "check",
        "cheese", "chef", "cherry", "chest", "chicken", "chief", "child", "chimney", "choice",
        "choose", "chronic", "chuckle", "chunk", "churn", "cigar", "cinnamon", "circle", "citizen",
        "city", "civil", "claim", "clap", "clarify", "claw", "clay", "clean", "clerk", "clever",
        "click", "client", "cliff", "climb", "clinic", "clip", "clock", "clog", "close", "cloth",
        "cloud", "clown", "club", "clump", "cluster", "clutch", "coach", "coast", "coconut",
        "code", "coffee", "coil", "coin", "collect", "color", "column", "combine", "come",
        "comfort", "comic", "common", "company", "concert", "conduct", "confirm", "congress",
        "connect", "consider", "control", "convince", "cook", "cool", "copper", "copy", "coral",
        "core", "corn", "correct", "cost", "cotton", "couch", "country", "couple", "course",
        "cousin", "cover", "coyote", "crack", "cradle", "craft", "cram", "crane", "crash",
        "crater", "crawl", "crazy", "cream", "credit", "creek", "crew", "cricket", "crime",
        "crisp", "critic", "crop", "cross", "crouch", "crowd", "crucial", "cruel", "cruise",
        "crumble", "crunch", "crush", "cry", "crystal", "cube", "culture", "cup", "cupboard",
        "curious", "current", "curtain", "curve", "cushion", "custom", "cute", "cycle", "dad",
        "damage", "damp", "dance", "danger", "daring", "dash", "daughter", "dawn", "day", "deal",
        "debate", "debris", "decade", "december", "decide", "decline", "decorate", "decrease",
        "deer", "defense", "define", "defy", "degree", "delay", "deliver", "demand", "demise",
        "denial", "dentist", "deny", "depart", "depend", "deposit", "depth", "deputy", "derive",
        "describe", "desert", "design", "desk", "despair", "destroy", "detail", "detect",
        "develop", "device", "devote", "diagram", "dial", "diamond", "diary", "dice", "diesel",
        "diet", "differ", "digital", "dignity", "dilemma", "dinner", "dinosaur", "direct", "dirt",
        "disagree", "discover", "disease", "dish", "dismiss", "disorder", "display", "distance",
        "divert", "divide", "divorce", "dizzy", "doctor", "document", "dog", "doll", "dolphin",
        "domain", "donate", "donkey", "donor", "door", "dose", "double", "dove", "draft", "dragon",
        "drama", "drastic", "draw", "dream", "dress", "drift", "drill", "drink", "drip", "drive",
        "drop", "drum", "dry", "duck", "dumb", "dune", "during", "dust", "dutch", "duty", "dwarf",
        "dynamic", "eager", "eagle", "early", "earn", "earth", "easily", "east", "easy", "echo",
        "ecology", "economy", "edge", "edit", "educate", "effort", "egg", "eight", "either",
        "elbow", "elder", "electric", "elegant", "element", "elephant", "elevator", "elite",
        "else", "embark", "embody", "embrace", "emerge", "emotion", "employ", "empower", "empty",
        "enable", "enact", "end", "endless", "endorse", "enemy", "energy", "enforce", "engage",
        "engine", "enhance", "enjoy", "enlist", "enough", "enrich", "enroll", "ensure", "enter",
        "entire", "entry", "envelope", "episode", "equal", "equip", "era", "erase", "erode",
        "erosion", "error", "erupt", "escape", "essay", "essence", "estate", "eternal", "ethics",
        "evidence", "evil", "evoke", "evolve", "exact", "example", "excess", "exchange", "excite",
        "exclude", "excuse", "execute", "exercise", "exhaust", "exhibit", "exile", "exist", "exit",
        "exotic", "expand", "expect", "expire", "explain", "expose", "express", "extend", "extra",
        "eye", "eyebrow", "fabric", "face", "faculty", "fade", "faint", "faith", "fall", "false",
        "fame", "family", "famous", "fan", "fancy", "fantasy", "farm", "fashion", "fat", "fatal",
        "father", "fatigue", "fault", "favorite", "feature", "february", "federal", "fee", "feed",
        "feel", "female", "fence", "festival", "fetch", "fever", "few", "fiber", "fiction",
        "field", "figure", "file", "film", "filter", "final", "find", "fine", "finger", "finish",
        "fire", "firm", "first", "fiscal", "fish", "fit", "fitness", "fix", "flag", "flame",
        "flash", "flat", "flavor", "flee", "flight", "flip", "float", "flock", "floor", "flower",
        "fluid", "flush", "fly", "foam", "focus", "fog", "foil", "fold", "follow", "food", "foot",
        "force", "forest", "forget", "fork", "fortune", "forum", "forward", "fossil", "foster",
        "found", "fox", "fragile", "frame", "frequent", "fresh", "friend", "fringe", "frog",
        "front", "frost", "frown", "frozen", "fruit", "fuel", "fun", "funny", "furnace", "fury",
        "future", "gadget", "gain", "galaxy", "gallery", "game", "gap", "garage", "garbage",
        "garden", "garlic", "garment", "gas", "gasp", "gate", "gather", "gauge", "gaze", "general",
        "genius", "genre", "gentle", "genuine", "gesture", "ghost", "giant", "gift", "giggle",
        "ginger", "giraffe", "girl", "give", "glad", "glance", "glare", "glass", "glide",
        "glimpse", "globe", "gloom", "glory", "glove", "glow", "glue", "goat", "goddess", "gold",
        "good", "goose", "gorilla", "gospel", "gossip", "govern", "gown", "grab", "grace", "grain",
        "grant", "grape", "grass", "gravity", "great", "green", "grid", "grief", "grit", "grocery",
        "group", "grow", "grunt", "guard", "guess", "guide", "guilt", "guitar", "gun", "gym",
        "habit", "hair", "half", "hammer", "hamster", "hand", "happy", "harbor", "hard", "harsh",
        "harvest", "hat", "have", "hawk", "hazard", "head", "health", "heart", "heavy", "hedgehog",
        "height", "hello", "helmet", "help", "hen", "hero", "hidden", "high", "hill", "hint",
        "hip", "hire", "history", "hobby", "hockey", "hold", "hole", "holiday", "hollow", "home",
        "honey", "hood", "hope", "horn", "horror", "horse", "hospital", "host", "hotel", "hour",
        "hover", "hub", "huge", "human", "humble", "humor", "hundred", "hungry", "hunt", "hurdle",
        "hurry", "hurt", "husband", "hybrid", "ice", "icon", "idea", "identify", "idle", "ignore",
        "ill", "illegal", "illness", "image", "imitate", "immense", "immune", "impact", "impose",
        "improve", "impulse", "inch", "include", "income", "increase", "index", "indicate",
        "indoor", "industry", "infant", "inflict", "inform", "inhale", "inherit", "initial",
        "inject", "injury", "inmate", "inner", "innocent", "input", "inquiry", "insane", "insect",
        "inside", "inspire", "install", "intact", "interest", "into", "invest", "invite",
        "involve", "iron", "island", "isolate", "issue", "item", "ivory", "jacket", "jaguar",
        "jar", "jazz", "jealous", "jeans", "jelly", "jewel", "job", "join", "joke", "journey",
        "joy", "judge", "juice", "jump", "jungle", "junior", "junk", "just", "kangaroo", "keen",
        "keep", "ketchup", "key", "kick", "kid", "kidney", "kind", "kingdom", "kiss", "kit",
        "kitchen", "kite", "kitten", "kiwi", "knee", "knife", "knock", "know", "lab", "label",
        "labor", "ladder", "lady", "lake", "lamp", "language", "laptop", "large", "later", "latin",
        "laugh", "laundry", "lava", "law", "lawn", "lawsuit", "layer", "lazy", "leader", "leaf",
        "learn", "leave", "lecture", "left", "leg", "legal", "legend", "leisure", "lemon", "lend",
        "length", "lens", "leopard", "lesson", "letter", "level", "liar", "liberty", "library",
        "license", "life", "lift", "light", "like", "limb", "limit", "link", "lion", "liquid",
        "list", "little", "live", "lizard", "load", "loan", "lobster", "local", "lock", "logic",
        "lonely", "long", "loop", "lottery", "loud", "lounge", "love", "loyal", "lucky", "luggage",
        "lumber", "lunar", "lunch", "luxury", "lyrics", "machine", "mad", "magic", "magnet",
        "maid", "mail", "main", "major", "make", "mammal", "man", "manage", "mandate", "mango",
        "mansion", "manual", "maple", "marble", "march", "margin", "marine", "market", "marriage",
        "mask", "mass", "master", "match", "material", "math", "matrix", "matter", "maximum",
        "maze", "meadow", "mean", "measure", "meat", "mechanic", "medal", "media", "melody",
        "melt", "member", "memory", "mention", "menu", "mercy", "merge", "merit", "merry", "mesh",
        "message", "metal", "method", "middle", "midnight", "milk", "million", "mimic", "mind",
        "minimum", "minor", "minute", "miracle", "mirror", "misery", "miss", "mistake", "mix",
        "mixed", "mixture", "mobile", "model", "modify", "mom", "moment", "monitor", "monkey",
        "monster", "month", "moon", "moral", "more", "morning", "mosquito", "mother", "motion",
        "motor", "mountain", "mouse", "move", "movie", "much", "muffin", "mule", "multiply",
        "muscle", "museum", "mushroom", "music", "must", "mutual", "myself", "mystery", "myth",
        "naive", "name", "napkin", "narrow", "nasty", "nation", "nature", "near", "neck", "need",
        "negative", "neglect", "neither", "nephew", "nerve", "nest", "net", "network", "neutral",
        "never", "news", "next", "nice", "night", "noble", "noise", "nominee", "noodle", "normal",
        "north", "nose", "notable", "note", "nothing", "notice", "novel", "now", "nuclear",
        "number", "nurse", "nut", "oak", "obey", "object", "oblige", "obscure", "observe",
        "obtain", "obvious", "occur", "ocean", "october", "odor", "off", "offer", "office",
        "often", "oil", "okay", "old", "olive", "olympic", "omit", "once", "one", "onion",
        "online", "only", "open", "opera", "opinion", "oppose", "option", "orange", "orbit",
        "orchard", "order", "ordinary", "organ", "orient", "original", "orphan", "ostrich",
        "other", "outdoor", "outer", "output", "outside", "oval", "oven", "over", "own", "owner",
        "oxygen", "oyster", "ozone", "pact", "paddle", "page", "pair", "palace", "palm", "panda",
        "panel", "panic", "panther", "paper", "parade", "parent", "park", "parrot", "party",
        "pass", "patch", "path", "patient", "patrol", "pattern", "pause", "pave", "payment",
        "peace", "peanut", "pear", "peasant", "pelican", "pen", "penalty", "pencil", "people",
        "pepper", "perfect", "permit", "person", "pet", "phone", "photo", "phrase", "physical",
        "piano", "picnic", "picture", "piece", "pig", "pigeon", "pill", "pilot", "pink", "pioneer",
        "pipe", "pistol", "pitch", "pizza", "place", "planet", "plastic", "plate", "play",
        "please", "pledge", "pluck", "plug", "plunge", "poem", "poet", "point", "polar", "pole",
        "police", "pond", "pony", "pool", "popular", "portion", "position", "possible", "post",
        "potato", "pottery", "poverty", "powder", "power", "practice", "praise", "predict",
        "prefer", "prepare", "present", "pretty", "prevent", "price", "pride", "primary", "print",
        "priority", "prison", "private", "prize", "problem", "process", "produce", "profit",
        "program", "project", "promote", "proof", "property", "prosper", "protect", "proud",
        "provide", "public", "pudding", "pull", "pulp", "pulse", "pumpkin", "punch", "pupil",
        "puppy", "purchase", "purity", "purpose", "purse", "push", "put", "puzzle", "pyramid",
        "quality", "quantum", "quarter", "question", "quick", "quit", "quiz", "quote", "rabbit",
        "raccoon", "race", "rack", "radar", "radio", "rail", "rain", "raise", "rally", "ramp",
        "ranch", "random", "range", "rapid", "rare", "rate", "rather", "raven", "raw", "razor",
        "ready", "real", "reason", "rebel", "rebuild", "recall", "receive", "recipe", "record",
        "recycle", "reduce", "reflect", "reform", "refuse", "region", "regret", "regular",
        "reject", "relax", "release", "relief", "rely", "remain", "remember", "remind", "remove",
        "render", "renew", "rent", "reopen", "repair", "repeat", "replace", "report", "require",
        "rescue", "resemble", "resist", "resource", "response", "result", "retire", "retreat",
        "return", "reunion", "reveal", "review", "reward", "rhythm", "rib", "ribbon", "rice",
        "rich", "ride", "ridge", "rifle", "right", "rigid", "ring", "riot", "ripple", "risk",
        "ritual", "rival", "river", "road", "roast", "robot", "robust", "rocket", "romance",
        "roof", "rookie", "room", "rose", "rotate", "rough", "round", "route", "royal", "rubber",
        "rude", "rug", "rule", "run", "runway", "rural", "sad", "saddle", "sadness", "safe",
        "sail", "salad", "salmon", "salon", "salt", "salute", "same", "sample", "sand", "satisfy",
        "satoshi", "sauce", "sausage", "save", "say", "scale", "scan", "scare", "scatter", "scene",
        "scheme", "school", "science", "scissors", "scorpion", "scout", "scrap", "screen",
        "script", "scrub", "sea", "search", "season", "seat", "second", "secret", "section",
        "security", "seed", "seek", "segment", "select", "sell", "seminar", "senior", "sense",
        "sentence", "series", "service", "session", "settle", "setup", "seven", "shadow", "shaft",
        "shallow", "share", "shed", "shell", "sheriff", "shield", "shift", "shine", "ship",
        "shiver", "shock", "shoe", "shoot", "shop", "short", "shoulder", "shove", "shrimp",
        "shrug", "shuffle", "shy", "sibling", "sick", "side", "siege", "sight", "sign", "silent",
        "silk", "silly", "silver", "similar", "simple", "since", "sing", "siren", "sister",
        "situate", "six", "size", "skate", "sketch", "ski", "skill", "skin", "skirt", "skull",
        "slab", "slam", "sleep", "slender", "slice", "slide", "slight", "slim", "slogan", "slot",
        "slow", "slush", "small", "smart", "smile", "smoke", "smooth", "snack", "snake", "snap",
        "sniff", "snow", "soap", "soccer", "social", "sock", "soda", "soft", "solar", "soldier",
        "solid", "solution", "solve", "someone", "song", "soon", "sorry", "sort", "soul", "sound",
        "soup", "source", "south", "space", "spare", "spatial", "spawn", "speak", "special",
        "speed", "spell", "spend", "sphere", "spice", "spider", "spike", "spin", "spirit", "split",
        "spoil", "sponsor", "spoon", "sport", "spot", "spray", "spread", "spring", "spy", "square",
        "squeeze", "squirrel", "stable", "stadium", "staff", "stage", "stairs", "stamp", "stand",
        "start", "state", "stay", "steak", "steel", "stem", "step", "stereo", "stick", "still",
        "sting", "stock", "stomach", "stone", "stool", "story", "stove", "strategy", "street",
        "strike", "strong", "struggle", "student", "stuff", "stumble", "style", "subject",
        "submit", "subway", "success", "such", "sudden", "suffer", "sugar", "suggest", "suit",
        "summer", "sun", "sunny", "sunset", "super", "supply", "supreme", "sure", "surface",
        "surge", "surprise", "surround", "survey", "suspect", "sustain", "swallow", "swamp",
        "swap", "swarm", "swear", "sweet", "swift", "swim", "swing", "switch", "sword", "symbol",
        "symptom", "syrup", "system", "table", "tackle", "tag", "tail", "talent", "talk", "tank",
        "tape", "target", "task", "taste", "tattoo", "taxi", "teach", "team", "tell", "ten",
        "tenant", "tennis", "tent", "term", "test", "text", "thank", "that", "theme", "then",
        "theory", "there", "they", "thing", "this", "thought", "three", "thrive", "throw", "thumb",
        "thunder", "ticket", "tide", "tiger", "tilt", "timber", "time", "tiny", "tip", "tired",
        "tissue", "title", "toast", "tobacco", "today", "toddler", "toe", "together", "toilet",
        "token", "tomato", "tomorrow", "tone", "tongue", "tonight", "tool", "tooth", "top",
        "topic", "topple", "torch", "tornado", "tortoise", "toss", "total", "tourist", "toward",
        "tower", "town", "toy", "track", "trade", "traffic", "tragic", "train", "transfer", "trap",
        "trash", "travel", "tray", "treat", "tree", "trend", "trial", "tribe", "trick", "trigger",
        "trim", "trip", "trophy", "trouble", "truck", "true", "truly", "trumpet", "trust", "truth",
        "try", "tube", "tuition", "tumble", "tuna", "tunnel", "turkey", "turn", "turtle", "twelve",
        "twenty", "twice", "twin", "twist", "two", "type", "typical", "ugly", "umbrella", "unable",
        "unaware", "uncle", "uncover", "under", "undo", "unfair", "unfold", "unhappy", "uniform",
        "unique", "unit", "universe", "unknown", "unlock", "until", "unusual", "unveil", "update",
        "upgrade", "uphold", "upon", "upper", "upset", "urban", "urge", "usage", "use", "used",
        "useful", "useless", "usual", "utility", "vacant", "vacuum", "vague", "valid", "valley",
        "valve", "van", "vanish", "vapor", "various", "vast", "vault", "vehicle", "velvet",
        "vendor", "venture", "venue", "verb", "verify", "version", "very", "vessel", "veteran",
        "viable", "vibrant", "vicious", "victory", "video", "view", "village", "vintage", "violin",
        "virtual", "virus", "visa", "visit", "visual", "vital", "vivid", "vocal", "voice", "void",
        "volcano", "volume", "vote", "voyage", "wage", "wagon", "wait", "walk", "wall", "walnut",
        "want", "warfare", "warm", "warrior", "wash", "wasp", "waste", "water", "wave", "way",
        "wealth", "weapon", "wear", "weasel", "weather", "web", "wedding", "weekend", "weird",
        "welcome", "west", "wet", "whale", "what", "wheat", "wheel", "when", "where", "whip",
        "whisper", "wide", "width", "wife", "wild", "will", "win", "window", "wine", "wing",
        "wink", "winner", "winter", "wire", "wisdom", "wise", "wish", "witness", "wolf", "woman",
        "wonder", "wood", "wool", "word", "work", "world", "worry", "worth", "wrap", "wreck",
        "wrestle", "wrist", "write", "wrong", "yard", "year", "yellow", "you", "young", "youth",
        "zebra", "zero", "zone", "zoo",
    ];

    #[test]
    fn test_from_entropy_valid_128_bits() {
        let entropy = [0u8; 16];
        let mnemonic = Mnemonic::from_entropy(&EN_WORDS, &entropy).unwrap();

        assert_eq!(mnemonic.word_count, 12);

        let expected_words = [
            "abandon", "abandon", "abandon", "abandon", "abandon", "abandon", "abandon", "abandon",
            "abandon", "abandon", "abandon", "about",
        ];

        let mut mnemonic_iter = mnemonic.iter();
        let mut expected_iter = expected_words.iter();

        for _ in 0..expected_words.len() {
            assert_eq!(mnemonic_iter.next(), expected_iter.next().copied());
        }

        assert_eq!(mnemonic_iter.next(), None);
        assert_eq!(expected_iter.next(), None);
    }

    #[test]
    fn test_from_entropy_valid_256_bits() {
        let entropy = [0u8; 32];
        let mnemonic = Mnemonic::from_entropy(&EN_WORDS, &entropy).unwrap();
        assert_eq!(mnemonic.word_count, 24);
    }

    #[test]
    fn test_from_entropy_invalid_length() {
        let entropy = [0u8; 17];
        let result = Mnemonic::from_entropy(&EN_WORDS, &entropy);
        assert_eq!(result, Err(Bip39Error::BadEntropyBitCount(136)));
    }

    #[test]
    fn test_from_entropy_too_short() {
        let entropy = [0u8; 4];
        let result = Mnemonic::from_entropy(&EN_WORDS, &entropy);
        assert_eq!(result, Err(Bip39Error::BadEntropyBitCount(32)));
    }

    #[test]
    fn test_from_entropy_too_long() {
        let entropy = [0u8; 36];
        let result = Mnemonic::from_entropy(&EN_WORDS, &entropy);
        assert_eq!(result, Err(Bip39Error::BadEntropyBitCount(288)));
    }

    #[test]
    fn test_checksum() {
        let vectors = [
            "00000000000000000000000000000000",
            "7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f",
            "80808080808080808080808080808080",
            "ffffffffffffffffffffffffffffffff",
            "000000000000000000000000000000000000000000000000",
            "7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f",
            "808080808080808080808080808080808080808080808080",
            "ffffffffffffffffffffffffffffffffffffffffffffffff",
            "0000000000000000000000000000000000000000000000000000000000000000",
            "7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f",
            "8080808080808080808080808080808080808080808080808080808080808080",
            "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
            "9e885d952ad362caeb4efe34a8e91bd2",
            "6610b25967cdcca9d59875f5cb50b0ea75433311869e930b",
            "68a79eaca2324873eacc50cb9c6eca8cc68ea5d936f98787c60c7ebc74e6ce7c",
            "c0ba5a8e914111210f2bd131f3d5e08d",
            "6d9be1ee6ebd27a258115aad99b7317b9c8d28b6d76431c3",
            "9f6a2878b2520799a44ef18bc7df394e7061a224d2c33cd015b157d746869863",
            "23db8160a31d3e0dca3688ed941adbf3",
            "8197a4a47f0425faeaa69deebc05ca29c0a5b5cc76ceacc0",
            "066dca1a2bb7e8a1db2832148ce9933eea0f3ac9548d793112d9a95c9407efad",
            "f30f8c1da665478f49b001d94c5fc452",
            "c10ec20dc3cd9f652c7fac2f1230f7a3c828389a14392f05",
            "f585c11aec520db57dd353c69554b21a89b20fb0650966fa0a9d6f74fd989d8f",
            "ed3b83f0d7913a19667a1cfd7298cd57",
            "70639a4e81b151277b345476d169a3743ff3c141",
            "ba2520298b92063a7a0ee1d453ba92513af81d4f86e1d336",
            "9447d2cf44349cd88a58f5b4ff6f83b9a2d54c42f033e12b8e4d00cc",
            "38711e550dc6557df8082b2a87f7860ebbe47ea5867a7068f5f0f5b85db68be8",
        ];

        for entropy_hex in &vectors {
            let ent = hex::decode(entropy_hex).unwrap();
            let m = Mnemonic::from_entropy(&EN_WORDS, &ent).unwrap();
            let word_count = m.word_count;
            let cs = m.checksum();
            let digest = Sha256::digest(&ent);
            assert_eq!(digest[0] >> (8 - (word_count / 3)), cs);
        }
    }

    #[test]
    fn test_invalid_engish() {
        assert_eq!(
            Mnemonic::parse_str(
                &EN_WORDS,
                &SecretString::from("getter advice cage absurd amount doctor acoustic avoid letter advice cage above"),
            ),
            Err(Bip39Error::UnknownWord(0))
        );

        assert_eq!(
            Mnemonic::parse_str(
                &EN_WORDS,
                &SecretString::from("letter advice cagex absurd amount doctor acoustic avoid letter advice cage above"),
            ),
            Err(Bip39Error::UnknownWord(2))
        );

        assert_eq!(
            Mnemonic::parse_str(
                &EN_WORDS,
                &SecretString::from("advice cage absurd amount doctor acoustic avoid letter advice cage above"),
            ),
            Err(Bip39Error::BadWordCount(11))
        );

        assert_eq!(
            Mnemonic::parse_str(
                &EN_WORDS,
                &SecretString::from("primary advice cage absurd amount doctor acoustic avoid letter advice cage above"),
            ),
            Err(Bip39Error::InvalidChecksum)
        );
    }

    #[test]
    fn test_vectors_english() {
        let test_vectors = [
            (
                "00000000000000000000000000000000",
                "abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon about",
                "c55257c360c07c72029aebc1b53c05ed0362ada38ead3e3e9efa3708e53495531f09a6987599d18264c1e1c92f2cf141630c7a3c4ab7c81b2f001698e7463b04",
            ),
            (
                "7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f",
                "legal winner thank year wave sausage worth useful legal winner thank yellow",
                "2e8905819b8723fe2c1d161860e5ee1830318dbf49a83bd451cfb8440c28bd6fa457fe1296106559a3c80937a1c1069be3a3a5bd381ee6260e8d9739fce1f607",
            ),
            (
                "80808080808080808080808080808080",
                "letter advice cage absurd amount doctor acoustic avoid letter advice cage above",
                "d71de856f81a8acc65e6fc851a38d4d7ec216fd0796d0a6827a3ad6ed5511a30fa280f12eb2e47ed2ac03b5c462a0358d18d69fe4f985ec81778c1b370b652a8",
            ),
            (
                "ffffffffffffffffffffffffffffffff",
                "zoo zoo zoo zoo zoo zoo zoo zoo zoo zoo zoo wrong",
                "ac27495480225222079d7be181583751e86f571027b0497b5b5d11218e0a8a13332572917f0f8e5a589620c6f15b11c61dee327651a14c34e18231052e48c069",
            ),
            (
                "000000000000000000000000000000000000000000000000",
                "abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon agent",
                "035895f2f481b1b0f01fcf8c289c794660b289981a78f8106447707fdd9666ca06da5a9a565181599b79f53b844d8a71dd9f439c52a3d7b3e8a79c906ac845fa",
            ),
            (
                "7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f",
                "legal winner thank year wave sausage worth useful legal winner thank year wave sausage worth useful legal will",
                "f2b94508732bcbacbcc020faefecfc89feafa6649a5491b8c952cede496c214a0c7b3c392d168748f2d4a612bada0753b52a1c7ac53c1e93abd5c6320b9e95dd",
            ),
            (
                "808080808080808080808080808080808080808080808080",
                "letter advice cage absurd amount doctor acoustic avoid letter advice cage absurd amount doctor acoustic avoid letter always",
                "107d7c02a5aa6f38c58083ff74f04c607c2d2c0ecc55501dadd72d025b751bc27fe913ffb796f841c49b1d33b610cf0e91d3aa239027f5e99fe4ce9e5088cd65",
            ),
            (
                "ffffffffffffffffffffffffffffffffffffffffffffffff",
                "zoo zoo zoo zoo zoo zoo zoo zoo zoo zoo zoo zoo zoo zoo zoo zoo zoo when",
                "0cd6e5d827bb62eb8fc1e262254223817fd068a74b5b449cc2f667c3f1f985a76379b43348d952e2265b4cd129090758b3e3c2c49103b5051aac2eaeb890a528",
            ),
            (
                "0000000000000000000000000000000000000000000000000000000000000000",
                "abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon art",
                "bda85446c68413707090a52022edd26a1c9462295029f2e60cd7c4f2bbd3097170af7a4d73245cafa9c3cca8d561a7c3de6f5d4a10be8ed2a5e608d68f92fcc8",
            ),
            (
                "7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f",
                "legal winner thank year wave sausage worth useful legal winner thank year wave sausage worth useful legal winner thank year wave sausage worth title",
                "bc09fca1804f7e69da93c2f2028eb238c227f2e9dda30cd63699232578480a4021b146ad717fbb7e451ce9eb835f43620bf5c514db0f8add49f5d121449d3e87",
            ),
            (
                "8080808080808080808080808080808080808080808080808080808080808080",
                "letter advice cage absurd amount doctor acoustic avoid letter advice cage absurd amount doctor acoustic avoid letter advice cage absurd amount doctor acoustic bless",
                "c0c519bd0e91a2ed54357d9d1ebef6f5af218a153624cf4f2da911a0ed8f7a09e2ef61af0aca007096df430022f7a2b6fb91661a9589097069720d015e4e982f",
            ),
            (
                "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
                "zoo zoo zoo zoo zoo zoo zoo zoo zoo zoo zoo zoo zoo zoo zoo zoo zoo zoo zoo zoo zoo zoo zoo vote",
                "dd48c104698c30cfe2b6142103248622fb7bb0ff692eebb00089b32d22484e1613912f0a5b694407be899ffd31ed3992c456cdf60f5d4564b8ba3f05a69890ad",
            ),
            (
                "9e885d952ad362caeb4efe34a8e91bd2",
                "ozone drill grab fiber curtain grace pudding thank cruise elder eight picnic",
                "274ddc525802f7c828d8ef7ddbcdc5304e87ac3535913611fbbfa986d0c9e5476c91689f9c8a54fd55bd38606aa6a8595ad213d4c9c9f9aca3fb217069a41028",
            ),
            (
                "6610b25967cdcca9d59875f5cb50b0ea75433311869e930b",
                "gravity machine north sort system female filter attitude volume fold club stay feature office ecology stable narrow fog",
                "628c3827a8823298ee685db84f55caa34b5cc195a778e52d45f59bcf75aba68e4d7590e101dc414bc1bbd5737666fbbef35d1f1903953b66624f910feef245ac",
            ),
            (
                "68a79eaca2324873eacc50cb9c6eca8cc68ea5d936f98787c60c7ebc74e6ce7c",
                "hamster diagram private dutch cause delay private meat slide toddler razor book happy fancy gospel tennis maple dilemma loan word shrug inflict delay length",
                "64c87cde7e12ecf6704ab95bb1408bef047c22db4cc7491c4271d170a1b213d20b385bc1588d9c7b38f1b39d415665b8a9030c9ec653d75e65f847d8fc1fc440",
            ),
            (
                "c0ba5a8e914111210f2bd131f3d5e08d",
                "scheme spot photo card baby mountain device kick cradle pact join borrow",
                "ea725895aaae8d4c1cf682c1bfd2d358d52ed9f0f0591131b559e2724bb234fca05aa9c02c57407e04ee9dc3b454aa63fbff483a8b11de949624b9f1831a9612",
            ),
            (
                "6d9be1ee6ebd27a258115aad99b7317b9c8d28b6d76431c3",
                "horn tenant knee talent sponsor spell gate clip pulse soap slush warm silver nephew swap uncle crack brave",
                "fd579828af3da1d32544ce4db5c73d53fc8acc4ddb1e3b251a31179cdb71e853c56d2fcb11aed39898ce6c34b10b5382772db8796e52837b54468aeb312cfc3d",
            ),
            (
                "9f6a2878b2520799a44ef18bc7df394e7061a224d2c33cd015b157d746869863",
                "panda eyebrow bullet gorilla call smoke muffin taste mesh discover soft ostrich alcohol speed nation flash devote level hobby quick inner drive ghost inside",
                "72be8e052fc4919d2adf28d5306b5474b0069df35b02303de8c1729c9538dbb6fc2d731d5f832193cd9fb6aeecbc469594a70e3dd50811b5067f3b88b28c3e8d",
            ),
            (
                "23db8160a31d3e0dca3688ed941adbf3",
                "cat swing flag economy stadium alone churn speed unique patch report train",
                "deb5f45449e615feff5640f2e49f933ff51895de3b4381832b3139941c57b59205a42480c52175b6efcffaa58a2503887c1e8b363a707256bdd2b587b46541f5",
            ),
            (
                "8197a4a47f0425faeaa69deebc05ca29c0a5b5cc76ceacc0",
                "light rule cinnamon wrap drastic word pride squirrel upgrade then income fatal apart sustain crack supply proud access",
                "4cbdff1ca2db800fd61cae72a57475fdc6bab03e441fd63f96dabd1f183ef5b782925f00105f318309a7e9c3ea6967c7801e46c8a58082674c860a37b93eda02",
            ),
            (
                "066dca1a2bb7e8a1db2832148ce9933eea0f3ac9548d793112d9a95c9407efad",
                "all hour make first leader extend hole alien behind guard gospel lava path output census museum junior mass reopen famous sing advance salt reform",
                "26e975ec644423f4a4c4f4215ef09b4bd7ef924e85d1d17c4cf3f136c2863cf6df0a475045652c57eb5fb41513ca2a2d67722b77e954b4b3fc11f7590449191d",
            ),
            (
                "f30f8c1da665478f49b001d94c5fc452",
                "vessel ladder alter error federal sibling chat ability sun glass valve picture",
                "2aaa9242daafcee6aa9d7269f17d4efe271e1b9a529178d7dc139cd18747090bf9d60295d0ce74309a78852a9caadf0af48aae1c6253839624076224374bc63f",
            ),
            (
                "c10ec20dc3cd9f652c7fac2f1230f7a3c828389a14392f05",
                "scissors invite lock maple supreme raw rapid void congress muscle digital elegant little brisk hair mango congress clump",
                "7b4a10be9d98e6cba265566db7f136718e1398c71cb581e1b2f464cac1ceedf4f3e274dc270003c670ad8d02c4558b2f8e39edea2775c9e232c7cb798b069e88",
            ),
            (
                "f585c11aec520db57dd353c69554b21a89b20fb0650966fa0a9d6f74fd989d8f",
                "void come effort suffer camp survey warrior heavy shoot primary clutch crush open amazing screen patrol group space point ten exist slush involve unfold",
                "01f5bced59dec48e362f2c45b5de68b9fd6c92c6634f44d6d40aab69056506f0e35524a518034ddc1192e1dacd32c1ed3eaa3c3b131c88ed8e7e54c49a5d0998",
            )
        ];

        for vector in &test_vectors {
            let entropy = hex::decode(&vector.0).unwrap();
            let mnemonic_str = vector.1;
            let seed = hex::decode(&vector.2).unwrap();
            let mnemonic = Mnemonic::from_entropy(&EN_WORDS, &entropy).unwrap();

            assert_eq!(
                mnemonic,
                Mnemonic::parse_str(&EN_WORDS, &SecretString::from(mnemonic_str)).unwrap(),
                "failed vector: {}",
                mnemonic_str
            );
            assert_eq!(
                &seed[..],
                mnemonic.to_seed(&SecretString::from("TREZOR")).unwrap().expose_secret().as_ref(),
                "failed vector: {}",
                mnemonic_str
            );

            {
                assert_eq!(
                    mnemonic.to_phrase().expose_secret(),
                    mnemonic_str,
                    "failed vector: {}",
                    mnemonic_str
                );
                assert_eq!(
                    mnemonic,
                    Mnemonic::parse_str(&EN_WORDS, &SecretString::from(mnemonic_str)).unwrap(),
                    "failed vector: {}",
                    mnemonic_str
                );
                assert_eq!(
                    mnemonic,
                    Mnemonic::parse_str(&EN_WORDS, &SecretString::from(mnemonic_str)).unwrap(),
                    "failed vector: {}",
                    mnemonic_str
                );
                assert_eq!(
                    &seed[..],
                    mnemonic.to_seed(&SecretString::from("TREZOR")).unwrap().expose_secret().as_ref(),
                    "failed vector: {}",
                    mnemonic_str
                );
                assert_eq!(
                    entropy,
                    mnemonic.to_entropy().expose_secret().to_vec(),
                    "failed vector: {}",
                    mnemonic_str
                );
            }
        }
    }

    #[test]
    fn test_invalid_mnemonic_restoration() {
        let mnemonic_str =
            "sword sure throw slide garden science six destroy canvas ceiling negative black";

        let mnemonic = Mnemonic::parse_str_without_checksum(&EN_WORDS, &SecretString::from(mnemonic_str)).unwrap();
        let entropy = mnemonic.to_entropy().expose_secret().to_vec();
        let restored_mnemonic = Mnemonic::from_entropy(&EN_WORDS, &entropy).unwrap();

        assert_ne!(
            mnemonic.to_phrase().expose_secret(),
            restored_mnemonic.to_phrase().expose_secret(),
            "Restored mnemonic should match original"
        );
    }

    #[test]
    fn test_vectors_japanese() {
        // These vectors are tuples of
        // (entropy, mnemonic, passphrase, seed)
        let vectors = [
			(
				"00000000000000000000000000000000",
				"あいこくしん あいこくしん あいこくしん あいこくしん あいこくしん あいこくしん あいこくしん あいこくしん あいこくしん あいこくしん あいこくしん あおぞら",
				"㍍ガバヴァぱばぐゞちぢ十人十色",
				"a262d6fb6122ecf45be09c50492b31f92e9beb7d9a845987a02cefda57a15f9c467a17872029a9e92299b5cbdf306e3a0ee620245cbd508959b6cb7ca637bd55",
			),
			(
				"7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f",
				"そつう れきだい ほんやく わかす りくつ ばいか ろせん やちん そつう れきだい ほんやく わかめ",
				"㍍ガバヴァぱばぐゞちぢ十人十色",
				"aee025cbe6ca256862f889e48110a6a382365142f7d16f2b9545285b3af64e542143a577e9c144e101a6bdca18f8d97ec3366ebf5b088b1c1af9bc31346e60d9",
			),
			(
				"80808080808080808080808080808080",
				"そとづら あまど おおう あこがれる いくぶん けいけん あたえる いよく そとづら あまど おおう あかちゃん",
				"㍍ガバヴァぱばぐゞちぢ十人十色",
				"e51736736ebdf77eda23fa17e31475fa1d9509c78f1deb6b4aacfbd760a7e2ad769c714352c95143b5c1241985bcb407df36d64e75dd5a2b78ca5d2ba82a3544",
			),
			(
				"ffffffffffffffffffffffffffffffff",
				"われる われる われる われる われる われる われる われる われる われる われる ろんぶん",
				"㍍ガバヴァぱばぐゞちぢ十人十色",
				"4cd2ef49b479af5e1efbbd1e0bdc117f6a29b1010211df4f78e2ed40082865793e57949236c43b9fe591ec70e5bb4298b8b71dc4b267bb96ed4ed282c8f7761c",
			),
			(
				"000000000000000000000000000000000000000000000000",
				"あいこくしん あいこくしん あいこくしん あいこくしん あいこくしん あいこくしん あいこくしん あいこくしん あいこくしん あいこくしん あいこくしん あいこくしん あいこくしん あいこくしん あいこくしん あいこくしん あいこくしん あらいぐま",
				"㍍ガバヴァぱばぐゞちぢ十人十色",
				"d99e8f1ce2d4288d30b9c815ae981edd923c01aa4ffdc5dee1ab5fe0d4a3e13966023324d119105aff266dac32e5cd11431eeca23bbd7202ff423f30d6776d69",
			),
			(
				"7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f",
				"そつう れきだい ほんやく わかす りくつ ばいか ろせん やちん そつう れきだい ほんやく わかす りくつ ばいか ろせん やちん そつう れいぎ",
				"㍍ガバヴァぱばぐゞちぢ十人十色",
				"eaaf171efa5de4838c758a93d6c86d2677d4ccda4a064a7136344e975f91fe61340ec8a615464b461d67baaf12b62ab5e742f944c7bd4ab6c341fbafba435716",
			),
			(
				"808080808080808080808080808080808080808080808080",
				"そとづら あまど おおう あこがれる いくぶん けいけん あたえる いよく そとづら あまど おおう あこがれる いくぶん けいけん あたえる いよく そとづら いきなり",
				"㍍ガバヴァぱばぐゞちぢ十人十色",
				"aec0f8d3167a10683374c222e6e632f2940c0826587ea0a73ac5d0493b6a632590179a6538287641a9fc9df8e6f24e01bf1be548e1f74fd7407ccd72ecebe425",
			),
			(
				"ffffffffffffffffffffffffffffffffffffffffffffffff",
				"われる われる われる われる われる われる われる われる われる われる われる われる われる われる われる われる われる りんご",
				"㍍ガバヴァぱばぐゞちぢ十人十色",
				"f0f738128a65b8d1854d68de50ed97ac1831fc3a978c569e415bbcb431a6a671d4377e3b56abd518daa861676c4da75a19ccb41e00c37d086941e471a4374b95",
			),
			(
				"0000000000000000000000000000000000000000000000000000000000000000",
				"あいこくしん あいこくしん あいこくしん あいこくしん あいこくしん あいこくしん あいこくしん あいこくしん あいこくしん あいこくしん あいこくしん あいこくしん あいこくしん あいこくしん あいこくしん あいこくしん あいこくしん あいこくしん あいこくしん あいこくしん あいこくしん あいこくしん あいこくしん いってい",
				"㍍ガバヴァぱばぐゞちぢ十人十色",
				"23f500eec4a563bf90cfda87b3e590b211b959985c555d17e88f46f7183590cd5793458b094a4dccc8f05807ec7bd2d19ce269e20568936a751f6f1ec7c14ddd",
			),
			(
				"7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f",
				"そつう れきだい ほんやく わかす りくつ ばいか ろせん やちん そつう れきだい ほんやく わかす りくつ ばいか ろせん やちん そつう れきだい ほんやく わかす りくつ ばいか ろせん まんきつ",
				"㍍ガバヴァぱばぐゞちぢ十人十色",
				"cd354a40aa2e241e8f306b3b752781b70dfd1c69190e510bc1297a9c5738e833bcdc179e81707d57263fb7564466f73d30bf979725ff783fb3eb4baa86560b05",
			),
			(
				"8080808080808080808080808080808080808080808080808080808080808080",
				"そとづら あまど おおう あこがれる いくぶん けいけん あたえる いよく そとづら あまど おおう あこがれる いくぶん けいけん あたえる いよく そとづら あまど おおう あこがれる いくぶん けいけん あたえる うめる",
				"㍍ガバヴァぱばぐゞちぢ十人十色",
				"6b7cd1b2cdfeeef8615077cadd6a0625f417f287652991c80206dbd82db17bf317d5c50a80bd9edd836b39daa1b6973359944c46d3fcc0129198dc7dc5cd0e68",
			),
			(
				"ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
				"われる われる われる われる われる われる われる われる われる われる われる われる われる われる われる われる われる われる われる われる われる われる われる らいう",
				"㍍ガバヴァぱばぐゞちぢ十人十色",
				"a44ba7054ac2f9226929d56505a51e13acdaa8a9097923ca07ea465c4c7e294c038f3f4e7e4b373726ba0057191aced6e48ac8d183f3a11569c426f0de414623",
			),
			(
				"77c2b00716cec7213839159e404db50d",
				"せまい うちがわ あずき かろう めずらしい だんち ますく おさめる ていぼう あたる すあな えしゃく",
				"㍍ガバヴァぱばぐゞちぢ十人十色",
				"344cef9efc37d0cb36d89def03d09144dd51167923487eec42c487f7428908546fa31a3c26b7391a2b3afe7db81b9f8c5007336b58e269ea0bd10749a87e0193",
			),
			(
				"b63a9c59a6e641f288ebc103017f1da9f8290b3da6bdef7b",
				"ぬすむ ふっかつ うどん こうりつ しつじ りょうり おたがい せもたれ あつめる いちりゅう はんしゃ ごますり そんけい たいちょう らしんばん ぶんせき やすみ ほいく",
				"㍍ガバヴァぱばぐゞちぢ十人十色",
				"b14e7d35904cb8569af0d6a016cee7066335a21c1c67891b01b83033cadb3e8a034a726e3909139ecd8b2eb9e9b05245684558f329b38480e262c1d6bc20ecc4",
			),
			(
				"3e141609b97933b66a060dcddc71fad1d91677db872031e85f4c015c5e7e8982",
				"くのう てぬぐい そんかい すろっと ちきゅう ほあん とさか はくしゅ ひびく みえる そざい てんすう たんぴん くしょう すいようび みけん きさらぎ げざん ふくざつ あつかう はやい くろう おやゆび こすう",
				"㍍ガバヴァぱばぐゞちぢ十人十色",
				"32e78dce2aff5db25aa7a4a32b493b5d10b4089923f3320c8b287a77e512455443298351beb3f7eb2390c4662a2e566eec5217e1a37467af43b46668d515e41b",
			),
			(
				"0460ef47585604c5660618db2e6a7e7f",
				"あみもの いきおい ふいうち にげる ざんしょ じかん ついか はたん ほあん すんぽう てちがい わかめ",
				"㍍ガバヴァぱばぐゞちぢ十人十色",
				"0acf902cd391e30f3f5cb0605d72a4c849342f62bd6a360298c7013d714d7e58ddf9c7fdf141d0949f17a2c9c37ced1d8cb2edabab97c4199b142c829850154b",
			),
			(
				"72f60ebac5dd8add8d2a25a797102c3ce21bc029c200076f",
				"すろっと にくしみ なやむ たとえる へいこう すくう きない けってい とくべつ ねっしん いたみ せんせい おくりがな まかい とくい けあな いきおい そそぐ",
				"㍍ガバヴァぱばぐゞちぢ十人十色",
				"9869e220bec09b6f0c0011f46e1f9032b269f096344028f5006a6e69ea5b0b8afabbb6944a23e11ebd021f182dd056d96e4e3657df241ca40babda532d364f73",
			),
			(
				"2c85efc7f24ee4573d2b81a6ec66cee209b2dcbd09d8eddc51e0215b0b68e416",
				"かほご きうい ゆたか みすえる もらう がっこう よそう ずっと ときどき したうけ にんか はっこう つみき すうじつ よけい くげん もくてき まわり せめる げざい にげる にんたい たんそく ほそく",
				"㍍ガバヴァぱばぐゞちぢ十人十色",
				"713b7e70c9fbc18c831bfd1f03302422822c3727a93a5efb9659bec6ad8d6f2c1b5c8ed8b0b77775feaf606e9d1cc0a84ac416a85514ad59f5541ff5e0382481",
			),
			(
				"eaebabb2383351fd31d703840b32e9e2",
				"めいえん さのう めだつ すてる きぬごし ろんぱ はんこ まける たいおう さかいし ねんいり はぶらし",
				"㍍ガバヴァぱばぐゞちぢ十人十色",
				"06e1d5289a97bcc95cb4a6360719131a786aba057d8efd603a547bd254261c2a97fcd3e8a4e766d5416437e956b388336d36c7ad2dba4ee6796f0249b10ee961",
			),
			(
				"7ac45cfe7722ee6c7ba84fbc2d5bd61b45cb2fe5eb65aa78",
				"せんぱい おしえる ぐんかん もらう きあい きぼう やおや いせえび のいず じゅしん よゆう きみつ さといも ちんもく ちわわ しんせいじ とめる はちみつ",
				"㍍ガバヴァぱばぐゞちぢ十人十色",
				"1fef28785d08cbf41d7a20a3a6891043395779ed74503a5652760ee8c24dfe60972105ee71d5168071a35ab7b5bd2f8831f75488078a90f0926c8e9171b2bc4a",
			),
			(
				"4fa1a8bc3e6d80ee1316050e862c1812031493212b7ec3f3bb1b08f168cabeef",
				"こころ いどう きあつ そうがんきょう へいあん せつりつ ごうせい はいち いびき きこく あんい おちつく きこえる けんとう たいこ すすめる はっけん ていど はんおん いんさつ うなぎ しねま れいぼう みつかる",
				"㍍ガバヴァぱばぐゞちぢ十人十色",
				"43de99b502e152d4c198542624511db3007c8f8f126a30818e856b2d8a20400d29e7a7e3fdd21f909e23be5e3c8d9aee3a739b0b65041ff0b8637276703f65c2",
			),
			(
				"18ab19a9f54a9274f03e5209a2ac8a91",
				"うりきれ さいせい じゆう むろん とどける ぐうたら はいれつ ひけつ いずれ うちあわせ おさめる おたく",
				"㍍ガバヴァぱばぐゞちぢ十人十色",
				"3d711f075ee44d8b535bb4561ad76d7d5350ea0b1f5d2eac054e869ff7963cdce9581097a477d697a2a9433a0c6884bea10a2193647677977c9820dd0921cbde",
			),
			(
				"18a2e1d81b8ecfb2a333adcb0c17a5b9eb76cc5d05db91a4",
				"うりきれ うねる せっさたくま きもち めんきょ へいたく たまご ぜっく びじゅつかん さんそ むせる せいじ ねくたい しはらい せおう ねんど たんまつ がいけん",
				"㍍ガバヴァぱばぐゞちぢ十人十色",
				"753ec9e333e616e9471482b4b70a18d413241f1e335c65cd7996f32b66cf95546612c51dcf12ead6f805f9ee3d965846b894ae99b24204954be80810d292fcdd",
			),
			(
				"15da872c95a13dd738fbf50e427583ad61f18fd99f628c417a61cf8343c90419",
				"うちゅう ふそく ひしょ がちょう うけもつ めいそう みかん そざい いばる うけとる さんま さこつ おうさま ぱんつ しひょう めした たはつ いちぶ つうじょう てさぎょう きつね みすえる いりぐち かめれおん",
				"㍍ガバヴァぱばぐゞちぢ十人十色",
				"346b7321d8c04f6f37b49fdf062a2fddc8e1bf8f1d33171b65074531ec546d1d3469974beccb1a09263440fc92e1042580a557fdce314e27ee4eabb25fa5e5fe",
			)
		];

        for vector in &vectors {
            let entropy = hex::decode(&vector.0).unwrap();
            let mnemonic_str = vector.1;
            let passphrase = vector.2;
            let seed = hex::decode(&vector.3).unwrap();

            let mnemonic = Mnemonic::from_entropy(&JA_WORDS, &entropy).unwrap();

            assert_eq!(
                seed,
                mnemonic.to_seed(&SecretString::from(passphrase)).unwrap().expose_secret().as_ref(),
                "failed vector: {}",
                mnemonic_str
            );
            let rt = Mnemonic::parse_str(&JA_WORDS, &mnemonic.to_phrase()).unwrap();
            assert_eq!(seed, rt.to_seed(&SecretString::from(passphrase)).unwrap().expose_secret().as_ref());

            let mnemonic = Mnemonic::parse_str(&JA_WORDS, &SecretString::from(mnemonic_str)).unwrap();
            assert_eq!(
                seed,
                mnemonic.to_seed(&SecretString::from(passphrase)).unwrap().expose_secret().as_ref(),
                "failed vector: {}",
                mnemonic_str
            );
        }
    }

    #[test]
    fn test_generate_and_validate_all_word_counts() {
        let mut rng = rand::rngs::StdRng::from_os_rng();

        for word_count in (MIN_NB_WORDS..=24).step_by(3) {
            let mnemonic = Mnemonic::generate(&mut rng, &EN_WORDS, word_count).unwrap();
            assert_eq!(mnemonic.word_count, word_count);

            let entropy = mnemonic.to_entropy().expose_secret().to_vec();
            let restored_mnemonic = Mnemonic::from_entropy(&EN_WORDS, &entropy).unwrap();
            assert_eq!(mnemonic, restored_mnemonic);

            let checksum_bits = word_count / 3;
            let digest = Sha256::digest(&entropy);
            let expected_checksum = digest[0] >> (8 - checksum_bits);
            let actual_checksum = mnemonic.checksum();

            assert_eq!(actual_checksum, expected_checksum);
        }
    }
}