mirror of
https://github.com/OneKeyHQ/bip39.git
synced 2026-04-06 19:03:49 +00:00
Compare commits
599 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a9bf4823c7 | ||
|
|
52e8f25e11 | ||
|
|
e2fdc5b942 | ||
|
|
450b0a571a | ||
|
|
5c4382c3c1 | ||
|
|
c3c7cebfe4 | ||
|
|
58d84449f4 | ||
|
|
9303d0e078 | ||
|
|
bd1f1706fe | ||
|
|
8d119065f0 | ||
|
|
45a8e2a218 | ||
|
|
d035063dcc | ||
|
|
26d2c54381 | ||
|
|
ecbc254ba3 | ||
|
|
874b6d4e08 | ||
|
|
1fa3f997a2 | ||
|
|
4cf9de3202 | ||
|
|
c04d31f82f | ||
|
|
530a9f6047 | ||
|
|
126af2bee3 | ||
|
|
c7e1af7300 | ||
|
|
c4f0c2908f | ||
|
|
941b099f14 | ||
|
|
83f23081a3 | ||
|
|
1dab87d842 | ||
|
|
83c580c678 | ||
|
|
8b44f5d19a | ||
|
|
a7705b8ebc | ||
|
|
f2081ee467 | ||
|
|
f50464249c | ||
|
|
ed720546bf | ||
|
|
e8f27ba2c3 | ||
|
|
be946a2061 | ||
|
|
a636b24619 | ||
|
|
f8fd590588 | ||
|
|
02eeb81713 | ||
|
|
18d64d9586 | ||
|
|
5b5b11fd96 | ||
|
|
2c86fb4746 | ||
|
|
85711db3bb | ||
|
|
1820b6ac67 | ||
|
|
b500a60e28 | ||
|
|
942de1bc5e | ||
|
|
43bef4e19d | ||
|
|
20bd34b014 | ||
|
|
23f393acfb | ||
|
|
c560e01e91 | ||
|
|
a362ff2f62 | ||
|
|
9a82f12b91 | ||
|
|
5e376b8903 | ||
|
|
90422a41af | ||
|
|
f3314418fb | ||
|
|
7da8c22eaf | ||
|
|
d9ad938b52 | ||
|
|
f7f579f5f5 | ||
|
|
2cd19306b2 | ||
|
|
545348d159 | ||
|
|
8835afe8a2 | ||
|
|
38e6aaed84 | ||
|
|
f7125606bf | ||
|
|
5b0b1a5c9a | ||
|
|
71573cb380 | ||
|
|
c64ff95697 | ||
|
|
6d2e202083 | ||
|
|
0cb81e1117 | ||
|
|
32ade2fbf7 | ||
|
|
ac7f150a79 | ||
|
|
134213954d | ||
|
|
253f4cb75f | ||
|
|
ebbb057dfa | ||
|
|
38626a2d1f | ||
|
|
990ce0d072 | ||
|
|
1ca3784b0a | ||
|
|
1b54929bda | ||
|
|
d75ddf4ea8 | ||
|
|
ad07c1c0b5 | ||
|
|
0b911fc20f | ||
|
|
73ccaa1357 | ||
|
|
bd1ecd20f9 | ||
|
|
e3668fb51f | ||
|
|
3c222e57df | ||
|
|
16ff1df7ab | ||
|
|
f2f8d8177e | ||
|
|
877b8bdfec | ||
|
|
5e211c6959 | ||
|
|
4e59e7d6fc | ||
|
|
8c3a56ec4f | ||
|
|
d31a0ad44b | ||
|
|
4566751b89 | ||
|
|
b386aaa06e | ||
|
|
ef95b4bfad | ||
|
|
30e3d246d4 | ||
|
|
647410b4a6 | ||
|
|
4669c88c67 | ||
|
|
9e865b8e75 | ||
|
|
08713ff9c2 | ||
|
|
ed52cda20d | ||
|
|
8ce57f3c13 | ||
|
|
043717034b | ||
|
|
eb100ec0e4 | ||
|
|
5cbd174c18 | ||
|
|
75722c6d24 | ||
|
|
7e75b98e1f | ||
|
|
47dbf58b6d | ||
|
|
42e00ef56a | ||
|
|
8dbf7d5837 | ||
|
|
bf96267f89 | ||
|
|
995bc58791 | ||
|
|
d7125cda1d | ||
|
|
b674c5710b | ||
|
|
920f7aa078 | ||
|
|
5c6e875f2d | ||
|
|
e086305895 | ||
|
|
863eee8ed7 | ||
|
|
4729ecca04 | ||
|
|
fba7e98aea | ||
|
|
95b306106f | ||
|
|
f32b24e380 | ||
|
|
26767a2ce3 | ||
|
|
a748c4b5c6 | ||
|
|
eaf7892872 | ||
|
|
677d18f2e0 | ||
|
|
f3051a6a9f | ||
|
|
bf528f65f4 | ||
|
|
5699633538 | ||
|
|
d1d8699fc4 | ||
|
|
e284827677 | ||
|
|
115eb45083 | ||
|
|
0d78c2a120 | ||
|
|
7594405011 | ||
|
|
d359fe64b2 | ||
|
|
1bf76fe32d | ||
|
|
904e39748c | ||
|
|
46054e445e | ||
|
|
4958ea8009 | ||
|
|
0e1fd95302 | ||
|
|
a823e5266c | ||
|
|
b64fb35301 | ||
|
|
54600393af | ||
|
|
ff2940e81e | ||
|
|
f3101bd3f1 | ||
|
|
46a5338e42 | ||
|
|
c578337f0f | ||
|
|
90f7a5ec93 | ||
|
|
dd496c82c1 | ||
|
|
1dafc30db4 | ||
|
|
927450e169 | ||
|
|
a67554c649 | ||
|
|
0bc6361db4 | ||
|
|
a98d40c43d | ||
|
|
54a8e781b4 | ||
|
|
c1d6274224 | ||
|
|
c16661aeea | ||
|
|
e9491c7efd | ||
|
|
d07983bc1f | ||
|
|
3aa7677ace | ||
|
|
9e04576e2f | ||
|
|
8131a07115 | ||
|
|
181b5d61e3 | ||
|
|
4dfc681f71 | ||
|
|
dfb4fd1be5 | ||
|
|
aa793f572f | ||
|
|
6973e692b0 | ||
|
|
22f8766947 | ||
|
|
8017442c50 | ||
|
|
82cf26c1cb | ||
|
|
206cbafceb | ||
|
|
9cf02dd452 | ||
|
|
f12242014d | ||
|
|
244c76022a | ||
|
|
516c16d721 | ||
|
|
f7e9fdf002 | ||
|
|
5c203fab6a | ||
|
|
40d542ba58 | ||
|
|
cc3c35487f | ||
|
|
76531b610a | ||
|
|
c845ee6f6e | ||
|
|
c394ec3c4f | ||
|
|
55367b989e | ||
|
|
732613e44c | ||
|
|
9ce31d3509 | ||
|
|
f8fae68efb | ||
|
|
93f3a286db | ||
|
|
3799728c76 | ||
|
|
b130271b2b | ||
|
|
ea2cb91a49 | ||
|
|
bfe1963eaa | ||
|
|
a04946e23e | ||
|
|
700294714c | ||
|
|
d93f2ba9f0 | ||
|
|
96ee8ab0a0 | ||
|
|
659b06a7b8 | ||
|
|
653538cd3a | ||
|
|
1ba5816184 | ||
|
|
0a23f51792 | ||
|
|
b9b3eaf670 | ||
|
|
7b29420f1a | ||
|
|
909297015e | ||
|
|
c7a092db32 | ||
|
|
de5fe245cc | ||
|
|
4dc041d77e | ||
|
|
7cfd04e318 | ||
|
|
d0428a8d21 | ||
|
|
3dbf117928 | ||
|
|
342ff964aa | ||
|
|
75138beed9 | ||
|
|
36523e0d97 | ||
|
|
44e705cd31 | ||
|
|
3e2af09e07 | ||
|
|
907172d6f0 | ||
|
|
394bce7c9e | ||
|
|
bc32c84166 | ||
|
|
76120cb0b4 | ||
|
|
385ee32fd4 | ||
|
|
5b689bd6e7 | ||
|
|
ac537983d9 | ||
|
|
5b2edb3998 | ||
|
|
eee4a60b35 | ||
|
|
dedb054fd8 | ||
|
|
079635cba1 | ||
|
|
5db3540e89 | ||
|
|
b502adc910 | ||
|
|
cab37a96c4 | ||
|
|
b603572295 | ||
|
|
8817e2487a | ||
|
|
c6c86591a9 | ||
|
|
5d1bb7d776 | ||
|
|
ea96c345cc | ||
|
|
318ec4dc9f | ||
|
|
ec38b3a263 | ||
|
|
9cec5dd2b7 | ||
|
|
31264e8bea | ||
|
|
e440d504fb | ||
|
|
786cd442cd | ||
|
|
9f675f2e47 | ||
|
|
e5c4aa4098 | ||
|
|
45e40c288f | ||
|
|
519e9dc728 | ||
|
|
67f18e2a63 | ||
|
|
c4f4208b95 | ||
|
|
881fbe2234 | ||
|
|
c7a1a00040 | ||
|
|
6aa2c1d26d | ||
|
|
9e836ac8e6 | ||
|
|
e2186682ac | ||
|
|
152f0ce966 | ||
|
|
084ff40d4f | ||
|
|
b244e34403 | ||
|
|
e33f4b2704 | ||
|
|
6c733477db | ||
|
|
a36c509c91 | ||
|
|
7d4e4cbe26 | ||
|
|
82e3938afe | ||
|
|
06cd4e7608 | ||
|
|
8b569deeae | ||
|
|
ad59508d7c | ||
|
|
562ece8004 | ||
|
|
8e3b890d26 | ||
|
|
6f53a445ee | ||
|
|
858c29e3be | ||
|
|
5a085aed79 | ||
|
|
7d68d5474e | ||
|
|
21e2e6c951 | ||
|
|
7f59c88dbc | ||
|
|
b85da0745a | ||
|
|
0ae59396f5 | ||
|
|
3451d1a81b | ||
|
|
22bb112ead | ||
|
|
af14981d83 | ||
|
|
9f3c111766 | ||
|
|
c2e4f93870 | ||
|
|
8e2d37d450 | ||
|
|
29040f3c8b | ||
|
|
6746a9a45e | ||
|
|
c768923b77 | ||
|
|
0d0099e633 | ||
|
|
bea736aeae | ||
|
|
31190ced31 | ||
|
|
575ee4de2c | ||
|
|
dfa696859a | ||
|
|
32b5b0363f | ||
|
|
c69e40942e | ||
|
|
8cb07685fd | ||
|
|
81a5a871d9 | ||
|
|
3e7b1ac938 | ||
|
|
16afe3ecbf | ||
|
|
2885ddd5f7 | ||
|
|
f9ab643475 | ||
|
|
17bb7e6953 | ||
|
|
b615704d4a | ||
|
|
c47f0030ec | ||
|
|
cb0300fc7b | ||
|
|
7cbfce747a | ||
|
|
dd99c5fde9 | ||
|
|
c4a09d67eb | ||
|
|
bf13c95fb0 | ||
|
|
30d6779baa | ||
|
|
d0889ab9de | ||
|
|
478e54ad47 | ||
|
|
3b36d6c3ba | ||
|
|
b9f4ee2d4e | ||
|
|
1b419bc615 | ||
|
|
961df0a5a5 | ||
|
|
491948dbcb | ||
|
|
7a11300336 | ||
|
|
dba22db54d | ||
|
|
6cbd3bc8c2 | ||
|
|
74762b369e | ||
|
|
5d7f36e9b2 | ||
|
|
b0be9d8b60 | ||
|
|
9d9fefbb28 | ||
|
|
584d1a41c7 | ||
|
|
a938c2f5a5 | ||
|
|
9f83f0fcd7 | ||
|
|
10980ed68c | ||
|
|
da6b42b2f0 | ||
|
|
5dcc0ce632 | ||
|
|
a34543f81e | ||
|
|
869f5375eb | ||
|
|
47d719a493 | ||
|
|
8aa5ad6ded | ||
|
|
a8cf5a4fd9 | ||
|
|
5c1ad0856a | ||
|
|
d2be7b6fd6 | ||
|
|
f22f7677a6 | ||
|
|
497fcf0e48 | ||
|
|
cceb518d09 | ||
|
|
ae27549baf | ||
|
|
8ba31a8985 | ||
|
|
4735db1064 | ||
|
|
612d6b4206 | ||
|
|
d354a1dfab | ||
|
|
d52d3f3784 | ||
|
|
22c443df83 | ||
|
|
8ffa333bc9 | ||
|
|
717a3ffcb2 | ||
|
|
d4fcdda9fb | ||
|
|
7f65b685b3 | ||
|
|
acf4c9b588 | ||
|
|
10cf809e7c | ||
|
|
3b6786bd51 | ||
|
|
5cdbe4620a | ||
|
|
8253325365 | ||
|
|
d100f3c0cb | ||
|
|
c1322c7c89 | ||
|
|
d9b5b5d0de | ||
|
|
20d077e3af | ||
|
|
97bde20b84 | ||
|
|
b1100c66eb | ||
|
|
d645b98261 | ||
|
|
31b846cf99 | ||
|
|
f1f1e39f89 | ||
|
|
3e4551b082 | ||
|
|
1fe8f5195f | ||
|
|
6f43581752 | ||
|
|
ce349ac99f | ||
|
|
38d1b296df | ||
|
|
a51ef005ac | ||
|
|
e066f14ecf | ||
|
|
628a2f53d4 | ||
|
|
f40c5c2423 | ||
|
|
65afae0b5e | ||
|
|
3381604035 | ||
|
|
ba637be876 | ||
|
|
611f76238d | ||
|
|
011533e4bc | ||
|
|
d2ba387163 | ||
|
|
64425922ae | ||
|
|
cd4425ece7 | ||
|
|
8a516f5529 | ||
|
|
455886617d | ||
|
|
8b2a093c8b | ||
|
|
37f237239a | ||
|
|
cd8893f6c9 | ||
|
|
7ef0db981f | ||
|
|
c4086c2413 | ||
|
|
2866e9d4d4 | ||
|
|
5ed5f6612d | ||
|
|
8c849703eb | ||
|
|
2575538b25 | ||
|
|
376ea8c46d | ||
|
|
a44c45e3c0 | ||
|
|
341700110b | ||
|
|
0529ca55fa | ||
|
|
9f6352d696 | ||
|
|
01e0ec16b9 | ||
|
|
54348219db | ||
|
|
23183e61af | ||
|
|
7d6078040d | ||
|
|
04ec88af5c | ||
|
|
5a1494327f | ||
|
|
e76cd8fbf3 | ||
|
|
7878bb3295 | ||
|
|
43e5cabfcf | ||
|
|
c1a5e79c5f | ||
|
|
3eee87560b | ||
|
|
74f0021ed0 | ||
|
|
d2f5d28e33 | ||
|
|
67df560a3c | ||
|
|
ae51db39a3 | ||
|
|
efe95a35c1 | ||
|
|
8103d17b09 | ||
|
|
e47cd1970f | ||
|
|
d221cd2f37 | ||
|
|
fe3c963b73 | ||
|
|
42fcf83e9b | ||
|
|
b7de1f3d89 | ||
|
|
0afecfc73c | ||
|
|
44a5d363c7 | ||
|
|
f83d786dd7 | ||
|
|
83fefeaf0b | ||
|
|
9d4e17928a | ||
|
|
0f9081e2b5 | ||
|
|
60727c5175 | ||
|
|
0d9c6c5458 | ||
|
|
c990aff819 | ||
|
|
4b1be40dea | ||
|
|
b4d881fbd0 | ||
|
|
cc9ed1c575 | ||
|
|
3b43552ceb | ||
|
|
e96d3876c4 | ||
|
|
0f1cfea04c | ||
|
|
9369eaa6d5 | ||
|
|
4218c87458 | ||
|
|
2ab3faf414 | ||
|
|
6db7516d4a | ||
|
|
0b6e351dce | ||
|
|
6f7fa3539e | ||
|
|
7733ac322b | ||
|
|
530648c174 | ||
|
|
c147cb5e4f | ||
|
|
bddd5d9f95 | ||
|
|
cbd0625ff7 | ||
|
|
bd06face96 | ||
|
|
5c3143888e | ||
|
|
55b878d8d5 | ||
|
|
370e201901 | ||
|
|
6df5b2a100 | ||
|
|
29c30bf33a | ||
|
|
bda303dd53 | ||
|
|
bb381a72ab | ||
|
|
35d9e9fddc | ||
|
|
1e2cc748b0 | ||
|
|
f62138da71 | ||
|
|
95edc76985 | ||
|
|
7d9b5f6871 | ||
|
|
24355c461b | ||
|
|
4b250c83eb | ||
|
|
e32531d9a9 | ||
|
|
ccdd300af3 | ||
|
|
e0f91e2029 | ||
|
|
956e44efd7 | ||
|
|
65cef19412 | ||
|
|
0702ecd352 | ||
|
|
584dbddd37 | ||
|
|
b08caad07e | ||
|
|
f150f0c03a | ||
|
|
e3bed0bfd0 | ||
|
|
0a5d28a7ad | ||
|
|
a08c709606 | ||
|
|
645945a00f | ||
|
|
85c906727a | ||
|
|
d1b4c8c579 | ||
|
|
e602fd18de | ||
|
|
85f762c905 | ||
|
|
3021870752 | ||
|
|
63e2e0755f | ||
|
|
9a2ca392f0 | ||
|
|
db37d63919 | ||
|
|
2eab7c3236 | ||
|
|
38122a3d58 | ||
|
|
680b94c1ef | ||
|
|
e5167afe28 | ||
|
|
88ae130125 | ||
|
|
27fa320125 | ||
|
|
dfbb5a65ff | ||
|
|
206a27352d | ||
|
|
0c9bbd03b0 | ||
|
|
52d698e42f | ||
|
|
b777ff554d | ||
|
|
0d876b51df | ||
|
|
ae008be5db | ||
|
|
2ed3f6c0c8 | ||
|
|
dfe833a7db | ||
|
|
fca07769eb | ||
|
|
5028988195 | ||
|
|
139becaf2c | ||
|
|
0514c20b81 | ||
|
|
f8ca25c338 | ||
|
|
548d94994b | ||
|
|
09d63290a4 | ||
|
|
d6cade868f | ||
|
|
048721a6ff | ||
|
|
892ce76fed | ||
|
|
aaa82c097f | ||
|
|
05311e7f54 | ||
|
|
40209fd898 | ||
|
|
e5520bb859 | ||
|
|
e1d0cf4f72 | ||
|
|
e82a142872 | ||
|
|
fcc7d12109 | ||
|
|
5dfe77e4a3 | ||
|
|
e21e32da31 | ||
|
|
ba678b1147 | ||
|
|
0b39e9dca7 | ||
|
|
cc61ec30c5 | ||
|
|
0f0a888e13 | ||
|
|
2ef27fb80b | ||
|
|
423fb969c6 | ||
|
|
9fae1ffbcc | ||
|
|
78db37f663 | ||
|
|
28e1cd455c | ||
|
|
47debf07ed | ||
|
|
cfc0c4d743 | ||
|
|
de8e5bc11f | ||
|
|
5c1003dde3 | ||
|
|
a78f4e280c | ||
|
|
4e9b492ca4 | ||
|
|
91eb2cbcfd | ||
|
|
c51bb4f9e5 | ||
|
|
3fa0f4cbef | ||
|
|
92fb39311e | ||
|
|
d00c719932 | ||
|
|
ab1bd64d52 | ||
|
|
aab3645f21 | ||
|
|
66419cf39c | ||
|
|
26dd39fd0e | ||
|
|
9225b805d6 | ||
|
|
f2de7aa7d8 | ||
|
|
9a54f27efc | ||
|
|
863fa61aaf | ||
|
|
2f410ee66e | ||
|
|
2087192332 | ||
|
|
74ab4cbe90 | ||
|
|
cf6c204497 | ||
|
|
c49e881294 | ||
|
|
0fd67b5915 | ||
|
|
1c2b8c6b2d | ||
|
|
9f59e99bec | ||
|
|
924727ed26 | ||
|
|
9183f9f658 | ||
|
|
f487fea9b8 | ||
|
|
5a10834a36 | ||
|
|
1f354b0390 | ||
|
|
0460b53f3a | ||
|
|
e8ee368f18 | ||
|
|
107edb3454 | ||
|
|
3960807353 | ||
|
|
214c584c40 | ||
|
|
c1396e87ed | ||
|
|
b57b721e2c | ||
|
|
0f6b34d68b | ||
|
|
2a01f39de7 | ||
|
|
93c3ef4757 | ||
|
|
fe8f2d140d | ||
|
|
0cca6e893a | ||
|
|
f2a1a8e67f | ||
|
|
8dd28f2cff | ||
|
|
4b1e5c340f | ||
|
|
2be42f9dba | ||
|
|
4aa771eb68 | ||
|
|
1102f20135 | ||
|
|
fb00a22d3f | ||
|
|
73b8724a6f | ||
|
|
8890d0f4c3 | ||
|
|
6e67990522 | ||
|
|
9ff30babbc | ||
|
|
ee0981f1ec | ||
|
|
6024e655a8 | ||
|
|
7e6bdc498e | ||
|
|
16b4c2788a | ||
|
|
0197de2795 | ||
|
|
861750ae51 | ||
|
|
a40d59d904 | ||
|
|
d933c3f731 | ||
|
|
408ecc184a | ||
|
|
00114002fe | ||
|
|
e80955983d | ||
|
|
f20b7e7128 | ||
|
|
908dc06fe8 | ||
|
|
3d548c6f9b | ||
|
|
0a8d06d03e | ||
|
|
88311463c7 | ||
|
|
cd7c8327b1 | ||
|
|
0cda44d5f6 | ||
|
|
7258b102c1 | ||
|
|
8d18f379fd | ||
|
|
3abab9b087 | ||
|
|
b18eb97ae3 | ||
|
|
88ea3e40ee | ||
|
|
8a9f391376 | ||
|
|
e40acc3ab0 | ||
|
|
56ad960105 | ||
|
|
f128bd58c4 | ||
|
|
0eda54f5a7 | ||
|
|
ed6d9d3905 | ||
|
|
47b64d3ee1 | ||
|
|
bc33f5ee53 | ||
|
|
c0df01895d |
2
.gitignore
vendored
Normal file
2
.gitignore
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
node_modules
|
||||
bip39-standalone.html
|
||||
47440
bip39-standalone.html
47440
bip39-standalone.html
File diff suppressed because one or more lines are too long
304
changelog.md
304
changelog.md
@@ -1,3 +1,307 @@
|
||||
# 0.5.5
|
||||
|
||||
* Fix BIP85 bug when pressing enter
|
||||
|
||||
# 0.5.4
|
||||
|
||||
* Add Particl network
|
||||
* Add Divi network
|
||||
* Add option to turn autocompute on / off
|
||||
* Add option to set custom number of pbkdf2 rounds
|
||||
* Fix blank mnemonic errors when using only seed
|
||||
|
||||
# 0.5.3
|
||||
|
||||
Add Starname network
|
||||
Add Terra network
|
||||
Add Bitcoin Private network
|
||||
Add Thorchain network
|
||||
Change Xwc network to Xwcc and add new Xwc
|
||||
Fix Bip85 works without mnemonic (using xprv)
|
||||
Fix extended key not updating when switching tabs
|
||||
Fix incorrect html closing tag
|
||||
|
||||
# 0.5.2
|
||||
|
||||
* Show ethereum private keys with correct padding
|
||||
|
||||
# 0.5.1
|
||||
|
||||
* Add Portuguese language
|
||||
* Add BIP85
|
||||
* Add Ritocoin
|
||||
* Add Cosmos Hub
|
||||
* Add ZooBC
|
||||
* Add Zcoin/Firo rebranded coin
|
||||
* Update Namecoin WIF
|
||||
|
||||
# 0.5.0
|
||||
|
||||
* Remove bias from base 6 and base 10 entropy
|
||||
* Add notes about card entropy
|
||||
* Hide/show split mnemonic cards
|
||||
* Fix link to standalone release file
|
||||
* Add Scribe network
|
||||
* Add Nano network
|
||||
* Add TRX network
|
||||
* Add Binance Smart Chain network
|
||||
* Clean up dependencies for eos-util
|
||||
* Update bootstrap to 3.4.1
|
||||
* Bump library versions
|
||||
|
||||
# 0.4.3
|
||||
|
||||
* Add FIO - Foundation for Interwallet Operability
|
||||
* Add Argoneum
|
||||
* Add CranePay
|
||||
* Add Jingtum network
|
||||
* Add MOAC
|
||||
* Update RSK network
|
||||
* Add HandShake
|
||||
* Add Sugarchain testnet
|
||||
* Fix wording "is a checksum" / "contains a checksum"
|
||||
* Fix bech32 prefix for monacoin
|
||||
|
||||
# 0.4.2
|
||||
|
||||
* Fix ethereum private key format
|
||||
|
||||
# 0.4.1
|
||||
|
||||
* Fix no loading on chrome with third-party cookies blocked
|
||||
* Add EtherCore
|
||||
* Add RSK network
|
||||
* Add DeepOnion segwit parameters
|
||||
* Fix ethereum xpub derivation
|
||||
|
||||
# 0.4.0
|
||||
|
||||
* Third party libraries deduplicated and minified
|
||||
* Add text reminder for multibit wallet change addresses
|
||||
* Seed field can be edited
|
||||
* Add bitcoin regtest parameters
|
||||
* Mnemonic conversion to entropy is hex encoded instead of binary
|
||||
* Entropy type can be manually selected
|
||||
* Add Bitcoin P2WSH and P2WSH-P2SH
|
||||
* Add Czech language
|
||||
|
||||
# 0.3.14
|
||||
|
||||
* Ethereum uses standard BIP44 as per majority of wallets (Issue 378)
|
||||
|
||||
# 0.3.13
|
||||
|
||||
* Add Thought network
|
||||
* Add Energyweb network
|
||||
* Add Elastos network
|
||||
* Add Groestlcoin
|
||||
* Fix for syscoin network
|
||||
* Add BSV, RPD, MONKEY, ARYA
|
||||
* Rename Zencash to Horizen
|
||||
* Update Hush network
|
||||
* Add CasinoCoin
|
||||
* Add CPUchain
|
||||
* Add Wagerr
|
||||
* Add VeChain
|
||||
* Option to not use 'change' field for ethereum networks in bip45
|
||||
* Add segwit parameters for MONKEY, BCA, BTC, MONA, SYS, VIA, DOGEt, LTCt
|
||||
* Convert mnemonic back to raw entropy
|
||||
* Add 2-of-3 phrase cards
|
||||
* Move position of hardened addresses checkbox to address table
|
||||
|
||||
# 0.3.12
|
||||
|
||||
* Fix typos
|
||||
* Fix DigiByte signing message
|
||||
* Add DeepOnion network
|
||||
* Add EOS network
|
||||
* Add LTC testnetwork
|
||||
* Add DOGE testnetwork
|
||||
* Add Stellar network
|
||||
* Add TWINS network
|
||||
* Add FIX network
|
||||
|
||||
# 0.3.11
|
||||
|
||||
* Add NIX network
|
||||
* Fix coin parameters for NMC, XMY, CLAM, ONX, LKR
|
||||
* Add DEXON network
|
||||
* Add Nebulas network
|
||||
* Add LSP network
|
||||
* Fix Crown network address format
|
||||
* Add Ellaism network
|
||||
* Add Etheresocial network
|
||||
* Add Bolivarcoin network
|
||||
* Force spellcheck and autocomplete to be off
|
||||
|
||||
# 0.3.10
|
||||
|
||||
* Add Phore network
|
||||
* Add Blocknode network
|
||||
* Add Ravencoin network
|
||||
* Add Safecoin network
|
||||
* Add LitecoinZ network
|
||||
* Add LKRcoin network
|
||||
* Update Peercoin scripthash parameter
|
||||
* Add Blockstamp network
|
||||
* Remove old info regarding use of private keys
|
||||
|
||||
# 0.3.9
|
||||
|
||||
* Update BTG signing message
|
||||
* Add segwit parameters for BTG
|
||||
* Add segwit parameters for DigiByte
|
||||
* Add Stash network (see 0.3.8s below)
|
||||
* Add Salus network
|
||||
* Add Cryptoescudo network
|
||||
* Add ExchangeCoin network
|
||||
* Add Artax network
|
||||
* Add BitCloud network
|
||||
* Add Megacoin network
|
||||
* Add Bitcoin Green network
|
||||
* Add ANON network
|
||||
* Add ProjectCoin network
|
||||
* Reword the 'generate' inputs and words
|
||||
* Add note for running http server in python 2
|
||||
* Adjust test to run reliably on slow computers
|
||||
|
||||
# 0.3.8s
|
||||
|
||||
* Add Stash network
|
||||
|
||||
# 0.3.8
|
||||
|
||||
* Add p2wpkh for litecoin
|
||||
* Add more networks - TSTRAT, Hush, ETC, PIRL, CLO, MIX, MUSIC, POA, EXP
|
||||
* Add coinomi/ledger client to BIP32 tab
|
||||
* Fix SYSCOIN and BTX parameters
|
||||
* Remove bip39-standalone.html from repository
|
||||
* Remove duplicate id properties on html elements
|
||||
|
||||
# 0.3.7
|
||||
|
||||
* Update AXE network parameters
|
||||
* Add new networks - Xuez, BTCP, BTCZ, ZCL, ZEN
|
||||
* Add litecoin bech32 params
|
||||
* Fix BIP38 for altcoins
|
||||
* Fix missing span closing tag
|
||||
* Add indicator to UI for when BIP84 is unavailable
|
||||
* Replace hasSegwit variable with test for segwit params
|
||||
* Allow xpub to be used as root key for segwit derivations
|
||||
* Add visual privacy safeguard
|
||||
|
||||
# 0.3.6
|
||||
|
||||
* Add Kobocoin
|
||||
* Update Vertcoin version byte and segwit support
|
||||
* Add Zcash
|
||||
* Korean mnemonics use ascii spaces
|
||||
* Add CashAddr address format for bitcoin cash
|
||||
|
||||
# 0.3.5
|
||||
|
||||
* Fix typo
|
||||
* Add Neblio network
|
||||
* Update bitcoinjs-lib from 3.3.0 to 3.3.2
|
||||
* Add Beetle Coin
|
||||
* Add segwit for bitcoin testnet and Fujicoin
|
||||
* Set coin number for Bitcoin God to 156
|
||||
* Add coins supported by coinomi
|
||||
* Warn when generating low entropy mnemonics
|
||||
* Warn when overriding weak entropy with a strong mnemonic length
|
||||
|
||||
# 0.3.4
|
||||
|
||||
* Add BlackCoin
|
||||
* Add Denarius
|
||||
* Raw entropy shows groupings with space every 11 bits
|
||||
* Checksum shown in entropy details
|
||||
* Warn that entropy values should exclude checksum
|
||||
* Add Korean language
|
||||
|
||||
# 0.3.3
|
||||
|
||||
* Add AXE network
|
||||
* Ethereum private key generation bugfix
|
||||
* Add BIP38 support
|
||||
* Allow initial number of rows to be set by the user
|
||||
|
||||
# 0.3.2
|
||||
|
||||
* Add Onixcoin
|
||||
* Add Komodo
|
||||
* BIP84 tab for derivation path
|
||||
* CSV tab for derived addresses
|
||||
|
||||
# 0.3.1
|
||||
|
||||
* Populate entropy field with hex value used from PRNG
|
||||
* Show list of word indexes
|
||||
* Fix typos
|
||||
* Update jquery from 2.1.1 to 3.2.1
|
||||
* Update bootstrap from 3.2.0 to 3.3.7
|
||||
* Move application-specific css into own file
|
||||
* QR codes with accents work correctly by replacing jquery.qrcode with kjua
|
||||
|
||||
# 0.3.0
|
||||
|
||||
* Update bitcoinjs from 3.1.1 to 3.3.0
|
||||
* Litecoin defaults to ltub instead of xpub
|
||||
* Segwit option removed from bip32 tab
|
||||
* BIP141 tab added for full segwit compatibility
|
||||
|
||||
# 0.2.9
|
||||
|
||||
* Update links from old site to new site
|
||||
* Add Monacoin
|
||||
* Add Bitcoin Gold
|
||||
* Port test suite to selenium
|
||||
* Allow more rows to be generated starting from a custom index
|
||||
|
||||
# 0.2.8
|
||||
|
||||
* Enable segwit for Litecoin
|
||||
* BitPay-style addresses for Bitcoin Cash
|
||||
* Use new xpub/xprv prefixes for Segwit BIP49
|
||||
* Add nubits network
|
||||
|
||||
# 0.2.7
|
||||
|
||||
* Add Fujicoin
|
||||
* List alternative tools
|
||||
* Remove unused translations and library
|
||||
|
||||
# 0.2.6
|
||||
|
||||
* Detect and warn when entropy is filtered / discarded
|
||||
* Reword entropy text to indicate using a single source only
|
||||
* Add BIP49 to More Info section
|
||||
* Update compile script to work across python 2 and 3
|
||||
* QR Codes use correctLevel 3 instead of 2
|
||||
* Source map removed from zxcvbn
|
||||
* Tidy up code with consistent use of commas and semicolons
|
||||
|
||||
# 0.2.5
|
||||
|
||||
* Rename variables for clarity between BIP49 and P2WPKH Nested In P2SH
|
||||
* Fix bug for validation of root key when using non-bitcoin networks
|
||||
* Add option to use P2WPKH Nested In P2SH addresses on BIP32 tab
|
||||
|
||||
# 0.2.4
|
||||
|
||||
* Show error when using xpub with hardened addresses
|
||||
* Allow switching litecoin prefixes between xprv and Ltpv
|
||||
|
||||
# 0.2.3
|
||||
|
||||
* Add maza coin
|
||||
|
||||
# 0.2.2
|
||||
|
||||
* Improve showing feedback for pending calculations
|
||||
* Bugfix: Clear old seed when mnemonic is changed
|
||||
* Add PIVX network
|
||||
|
||||
# 0.2.1
|
||||
|
||||
* BTC is the default coin
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import os
|
||||
import re
|
||||
import datetime
|
||||
from io import open
|
||||
|
||||
# This script generates the bip39-standalone.html file.
|
||||
|
||||
|
||||
58
dev_env_setup.sh
Executable file
58
dev_env_setup.sh
Executable file
@@ -0,0 +1,58 @@
|
||||
# this script is intended to be run in a VM
|
||||
# running ubuntu 20.04 server
|
||||
# from the root directory of this repo
|
||||
|
||||
echo "This script is intended to be run in a VM."
|
||||
echo "It may do things to your OS that you don't want to be peristent."
|
||||
echo "Please type virtualmachine to continue, or Ctrl-C to quit."
|
||||
|
||||
read passage
|
||||
|
||||
if [ "$passage" = "virtualmachine" ]; then
|
||||
echo "Installing dev environment"
|
||||
else
|
||||
echo "Did not type virtualmachine, quitting with no changes applied"
|
||||
exit
|
||||
fi
|
||||
|
||||
# set up place for local binaries
|
||||
mkdir $HOME/.bin
|
||||
echo "export PATH=$PATH:$HOME/.bin" >> $HOME/.bashrc
|
||||
source $HOME/.bashrc
|
||||
|
||||
# allow python3 to be run with python command
|
||||
ln -s /usr/bin/python3 $HOME/.bin/python
|
||||
|
||||
# install firefox and other dependencies
|
||||
sudo apt-get -y install firefox unzip openjdk-11-jre-headless xvfb libxi6 libgconf-2-4 make build-essential
|
||||
# install chrome
|
||||
curl -sS -o - https://dl-ssl.google.com/linux/linux_signing_key.pub | sudo apt-key add
|
||||
sudo sh -c "echo \"deb https://dl.google.com/linux/chrome/deb/ stable main\" >> /etc/apt/sources.list.d/google-chrome.list"
|
||||
sudo apt-get -y update
|
||||
sudo apt-get -y install google-chrome-stable
|
||||
|
||||
# install nodejs for running tests
|
||||
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.36.0/install.sh | bash
|
||||
# load nvm
|
||||
source $HOME/.bashrc
|
||||
export NVM_DIR="$HOME/.nvm"
|
||||
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
|
||||
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
|
||||
# install latest node
|
||||
nvm install node
|
||||
# install jasmine
|
||||
cd tests
|
||||
npm install --global jasmine
|
||||
npm install selenium-webdriver
|
||||
# install gecko webdriver for firefox
|
||||
wget https://github.com/mozilla/geckodriver/releases/download/v0.29.0/geckodriver-v0.29.0-linux64.tar.gz --output-document=/tmp/geckodriver.tar.gz
|
||||
tar -xf /tmp/geckodriver.tar.gz -C $HOME/.bin
|
||||
# install chrome webdriver for chromium
|
||||
wget https://chromedriver.storage.googleapis.com/88.0.4324.96/chromedriver_linux64.zip --output-document=/tmp/chromedriver.zip
|
||||
unzip /tmp/chromedriver.zip -d $HOME/.bin
|
||||
|
||||
# to run tests
|
||||
# cd tests
|
||||
# Xvfb :1 -screen 1 1024x768x24 & export DISPLAY=:1.1
|
||||
# BROWSER=firefox jasmine spec/tests.js
|
||||
# BROWSER=chrome jasmine spec/tests.js
|
||||
22
libs/base-x/LICENSE.md
Normal file
22
libs/base-x/LICENSE.md
Normal file
@@ -0,0 +1,22 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2018 base-x contributors
|
||||
Copyright (c) 2014-2018 The Bitcoin Core developers
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
44
libs/base-x/package.json
Normal file
44
libs/base-x/package.json
Normal file
@@ -0,0 +1,44 @@
|
||||
{
|
||||
"name": "base-x",
|
||||
"version": "3.0.7",
|
||||
"description": "Fast base encoding / decoding of any given alphabet",
|
||||
"keywords": [
|
||||
"base-x",
|
||||
"base58",
|
||||
"base62",
|
||||
"base64",
|
||||
"crypto",
|
||||
"crytography",
|
||||
"decode",
|
||||
"decoding",
|
||||
"encode",
|
||||
"encoding"
|
||||
],
|
||||
"homepage": "https://github.com/cryptocoinjs/base-x",
|
||||
"bugs": {
|
||||
"url": "https://github.com/cryptocoinjs/base-x/issues"
|
||||
},
|
||||
"license": "MIT",
|
||||
"author": "Daniel Cousens",
|
||||
"files": [
|
||||
"src"
|
||||
],
|
||||
"main": "src/index.js",
|
||||
"types": "src/index.d.ts",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/cryptocoinjs/base-x.git"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "tsc -p ./tsconfig.json ; standard --fix; browserify src/index.js --standalone basex > /tmp/base-x.js"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "12.0.10",
|
||||
"standard": "^10.0.3",
|
||||
"tape": "^4.5.1",
|
||||
"typescript": "3.5.2"
|
||||
},
|
||||
"dependencies": {
|
||||
"safe-buffer": "^5.0.1"
|
||||
}
|
||||
}
|
||||
4
libs/base-x/readme.md
Normal file
4
libs/base-x/readme.md
Normal file
@@ -0,0 +1,4 @@
|
||||
Build (will create a bundle and copy it to /tmp/base-x.js):
|
||||
|
||||
npm install
|
||||
npm run build
|
||||
161
libs/base-x/ts_src/index.ts
Normal file
161
libs/base-x/ts_src/index.ts
Normal file
@@ -0,0 +1,161 @@
|
||||
// base-x encoding / decoding
|
||||
// Copyright (c) 2018 base-x contributors
|
||||
// Copyright (c) 2014-2018 The Bitcoin Core developers (base58.cpp)
|
||||
// Distributed under the MIT software license, see the accompanying
|
||||
// file LICENSE or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
// @ts-ignore
|
||||
const _Buffer = require('safe-buffer').Buffer;
|
||||
|
||||
function base (ALPHABET: string): base.BaseConverter {
|
||||
if (ALPHABET.length >= 255) throw new TypeError('Alphabet too long')
|
||||
|
||||
const BASE_MAP = new Uint8Array(256)
|
||||
BASE_MAP.fill(255)
|
||||
|
||||
for (let i = 0; i < ALPHABET.length; i++) {
|
||||
const x = ALPHABET.charAt(i)
|
||||
const xc = x.charCodeAt(0)
|
||||
|
||||
if (BASE_MAP[xc] !== 255) throw new TypeError(x + ' is ambiguous')
|
||||
BASE_MAP[xc] = i
|
||||
}
|
||||
|
||||
const BASE = ALPHABET.length
|
||||
const LEADER = ALPHABET.charAt(0)
|
||||
const FACTOR = Math.log(BASE) / Math.log(256) // log(BASE) / log(256), rounded up
|
||||
const iFACTOR = Math.log(256) / Math.log(BASE) // log(256) / log(BASE), rounded up
|
||||
|
||||
function encode (source: Buffer): string {
|
||||
if (!_Buffer.isBuffer(source)) throw new TypeError('Expected Buffer')
|
||||
if (source.length === 0) return ''
|
||||
|
||||
// Skip & count leading zeroes.
|
||||
let zeroes = 0
|
||||
let length = 0
|
||||
let pbegin = 0
|
||||
const pend = source.length
|
||||
|
||||
while (pbegin !== pend && source[pbegin] === 0) {
|
||||
pbegin++
|
||||
zeroes++
|
||||
}
|
||||
|
||||
// Allocate enough space in big-endian base58 representation.
|
||||
const size = ((pend - pbegin) * iFACTOR + 1) >>> 0
|
||||
const b58 = new Uint8Array(size)
|
||||
|
||||
// Process the bytes.
|
||||
while (pbegin !== pend) {
|
||||
let carry = source[pbegin]
|
||||
|
||||
// Apply "b58 = b58 * 256 + ch".
|
||||
let i = 0
|
||||
for (let it1 = size - 1; (carry !== 0 || i < length) && (it1 !== -1); it1--, i++) {
|
||||
carry += (256 * b58[it1]) >>> 0
|
||||
b58[it1] = (carry % BASE) >>> 0
|
||||
carry = (carry / BASE) >>> 0
|
||||
}
|
||||
|
||||
if (carry !== 0) throw new Error('Non-zero carry')
|
||||
length = i
|
||||
pbegin++
|
||||
}
|
||||
|
||||
// Skip leading zeroes in base58 result.
|
||||
let it2 = size - length
|
||||
while (it2 !== size && b58[it2] === 0) {
|
||||
it2++
|
||||
}
|
||||
|
||||
// Translate the result into a string.
|
||||
let str = LEADER.repeat(zeroes)
|
||||
for (; it2 < size; ++it2) str += ALPHABET.charAt(b58[it2])
|
||||
|
||||
return str
|
||||
}
|
||||
|
||||
function decodeUnsafe (source: string): Buffer | undefined {
|
||||
if (typeof source !== 'string') throw new TypeError('Expected String')
|
||||
if (source.length === 0) return _Buffer.alloc(0)
|
||||
|
||||
let psz = 0
|
||||
|
||||
// Skip leading spaces.
|
||||
if (source[psz] === ' ') return
|
||||
|
||||
// Skip and count leading '1's.
|
||||
let zeroes = 0
|
||||
let length = 0
|
||||
while (source[psz] === LEADER) {
|
||||
zeroes++
|
||||
psz++
|
||||
}
|
||||
|
||||
// Allocate enough space in big-endian base256 representation.
|
||||
const size = (((source.length - psz) * FACTOR) + 1) >>> 0 // log(58) / log(256), rounded up.
|
||||
const b256 = new Uint8Array(size)
|
||||
|
||||
// Process the characters.
|
||||
while (source[psz]) {
|
||||
// Decode character
|
||||
let carry = BASE_MAP[source.charCodeAt(psz)]
|
||||
|
||||
// Invalid character
|
||||
if (carry === 255) return
|
||||
|
||||
let i = 0
|
||||
for (let it3 = size - 1; (carry !== 0 || i < length) && (it3 !== -1); it3--, i++) {
|
||||
carry += (BASE * b256[it3]) >>> 0
|
||||
b256[it3] = (carry % 256) >>> 0
|
||||
carry = (carry / 256) >>> 0
|
||||
}
|
||||
|
||||
if (carry !== 0) throw new Error('Non-zero carry')
|
||||
length = i
|
||||
psz++
|
||||
}
|
||||
|
||||
// Skip trailing spaces.
|
||||
if (source[psz] === ' ') return
|
||||
|
||||
// Skip leading zeroes in b256.
|
||||
let it4 = size - length
|
||||
while (it4 !== size && b256[it4] === 0) {
|
||||
it4++
|
||||
}
|
||||
|
||||
const vch = _Buffer.allocUnsafe(zeroes + (size - it4))
|
||||
vch.fill(0x00, 0, zeroes)
|
||||
|
||||
let j = zeroes
|
||||
while (it4 !== size) {
|
||||
vch[j++] = b256[it4++]
|
||||
}
|
||||
|
||||
return vch
|
||||
}
|
||||
|
||||
function decode (string: string): Buffer {
|
||||
const buffer = decodeUnsafe(string)
|
||||
if (buffer) return buffer
|
||||
|
||||
throw new Error('Non-base' + BASE + ' character')
|
||||
}
|
||||
|
||||
return {
|
||||
encode: encode,
|
||||
decodeUnsafe: decodeUnsafe,
|
||||
decode: decode
|
||||
}
|
||||
}
|
||||
|
||||
export = base;
|
||||
|
||||
declare namespace base {
|
||||
interface BaseConverter {
|
||||
encode(buffer: Buffer): string;
|
||||
decodeUnsafe(string: string): Buffer | undefined;
|
||||
decode(string: string): Buffer;
|
||||
}
|
||||
}
|
||||
31
libs/base-x/tsconfig.json
Normal file
31
libs/base-x/tsconfig.json
Normal file
@@ -0,0 +1,31 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"target": "ES5",
|
||||
"module": "commonjs",
|
||||
"outDir": "./src",
|
||||
"declaration": true,
|
||||
"rootDir": "./ts_src",
|
||||
"types": [
|
||||
"node"
|
||||
],
|
||||
"allowJs": false,
|
||||
"strict": true,
|
||||
"noImplicitAny": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"strictBindCallApply": true,
|
||||
"strictPropertyInitialization": true,
|
||||
"noImplicitThis": true,
|
||||
"alwaysStrict": true,
|
||||
"esModuleInterop": false,
|
||||
"noUnusedLocals": true,
|
||||
"noUnusedParameters": true
|
||||
},
|
||||
"include": [
|
||||
"ts_src/**/*.ts"
|
||||
],
|
||||
"exclude": [
|
||||
"**/*.spec.ts",
|
||||
"node_modules/**/*"
|
||||
]
|
||||
}
|
||||
244
libs/bitcoinjs-bip38/index.js
Normal file
244
libs/bitcoinjs-bip38/index.js
Normal file
@@ -0,0 +1,244 @@
|
||||
var aes = require('browserify-aes')
|
||||
var assert = require('assert')
|
||||
var Buffer = require('safe-buffer').Buffer
|
||||
var bs58check = require('bs58check')
|
||||
var createHash = require('create-hash')
|
||||
var scrypt = require('scryptsy')
|
||||
var xor = require('buffer-xor/inplace')
|
||||
|
||||
var ecurve = require('ecurve')
|
||||
var curve = ecurve.getCurveByName('secp256k1')
|
||||
|
||||
var BigInteger = require('bigi')
|
||||
|
||||
// constants
|
||||
var SCRYPT_PARAMS = {
|
||||
N: 16384, // specified by BIP38
|
||||
r: 8,
|
||||
p: 8
|
||||
}
|
||||
var NULL = Buffer.alloc(0)
|
||||
|
||||
function hash160 (buffer) {
|
||||
var hash
|
||||
try {
|
||||
hash = createHash('rmd160')
|
||||
} catch (e) {
|
||||
hash = createHash('ripemd160')
|
||||
}
|
||||
return hash.update(
|
||||
createHash('sha256').update(buffer).digest()
|
||||
).digest()
|
||||
}
|
||||
|
||||
function hash256 (buffer) {
|
||||
return createHash('sha256').update(
|
||||
createHash('sha256').update(buffer).digest()
|
||||
).digest()
|
||||
}
|
||||
|
||||
function getAddress (d, compressed) {
|
||||
var Q = curve.G.multiply(d).getEncoded(compressed)
|
||||
var hash = hash160(Q)
|
||||
var payload = Buffer.allocUnsafe(21)
|
||||
payload.writeUInt8(0x00, 0) // XXX TODO FIXME bitcoin only??? damn you BIP38
|
||||
hash.copy(payload, 1)
|
||||
|
||||
return bs58check.encode(payload)
|
||||
}
|
||||
|
||||
function encryptRaw (buffer, compressed, passphrase, progressCallback, scryptParams) {
|
||||
if (buffer.length !== 32) throw new Error('Invalid private key length')
|
||||
scryptParams = scryptParams || SCRYPT_PARAMS
|
||||
|
||||
var d = BigInteger.fromBuffer(buffer)
|
||||
var address = getAddress(d, compressed)
|
||||
var secret = Buffer.from(passphrase, 'utf8')
|
||||
var salt = hash256(address).slice(0, 4)
|
||||
|
||||
var N = scryptParams.N
|
||||
var r = scryptParams.r
|
||||
var p = scryptParams.p
|
||||
|
||||
var scryptBuf = scrypt(secret, salt, N, r, p, 64, progressCallback)
|
||||
var derivedHalf1 = scryptBuf.slice(0, 32)
|
||||
var derivedHalf2 = scryptBuf.slice(32, 64)
|
||||
|
||||
var xorBuf = xor(derivedHalf1, buffer)
|
||||
var cipher = aes.createCipheriv('aes-256-ecb', derivedHalf2, NULL)
|
||||
cipher.setAutoPadding(false)
|
||||
cipher.end(xorBuf)
|
||||
|
||||
var cipherText = cipher.read()
|
||||
|
||||
// 0x01 | 0x42 | flagByte | salt (4) | cipherText (32)
|
||||
var result = Buffer.allocUnsafe(7 + 32)
|
||||
result.writeUInt8(0x01, 0)
|
||||
result.writeUInt8(0x42, 1)
|
||||
result.writeUInt8(compressed ? 0xe0 : 0xc0, 2)
|
||||
salt.copy(result, 3)
|
||||
cipherText.copy(result, 7)
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
function encrypt (buffer, compressed, passphrase, progressCallback, scryptParams) {
|
||||
return bs58check.encode(encryptRaw(buffer, compressed, passphrase, progressCallback, scryptParams))
|
||||
}
|
||||
|
||||
// some of the techniques borrowed from: https://github.com/pointbiz/bitaddress.org
|
||||
function decryptRaw (buffer, passphrase, progressCallback, scryptParams) {
|
||||
// 39 bytes: 2 bytes prefix, 37 bytes payload
|
||||
if (buffer.length !== 39) throw new Error('Invalid BIP38 data length')
|
||||
if (buffer.readUInt8(0) !== 0x01) throw new Error('Invalid BIP38 prefix')
|
||||
scryptParams = scryptParams || SCRYPT_PARAMS
|
||||
|
||||
// check if BIP38 EC multiply
|
||||
var type = buffer.readUInt8(1)
|
||||
if (type === 0x43) return decryptECMult(buffer, passphrase, progressCallback, scryptParams)
|
||||
if (type !== 0x42) throw new Error('Invalid BIP38 type')
|
||||
|
||||
passphrase = Buffer.from(passphrase, 'utf8')
|
||||
|
||||
var flagByte = buffer.readUInt8(2)
|
||||
var compressed = flagByte === 0xe0
|
||||
if (!compressed && flagByte !== 0xc0) throw new Error('Invalid BIP38 compression flag')
|
||||
|
||||
var N = scryptParams.N
|
||||
var r = scryptParams.r
|
||||
var p = scryptParams.p
|
||||
|
||||
var salt = buffer.slice(3, 7)
|
||||
var scryptBuf = scrypt(passphrase, salt, N, r, p, 64, progressCallback)
|
||||
var derivedHalf1 = scryptBuf.slice(0, 32)
|
||||
var derivedHalf2 = scryptBuf.slice(32, 64)
|
||||
|
||||
var privKeyBuf = buffer.slice(7, 7 + 32)
|
||||
var decipher = aes.createDecipheriv('aes-256-ecb', derivedHalf2, NULL)
|
||||
decipher.setAutoPadding(false)
|
||||
decipher.end(privKeyBuf)
|
||||
|
||||
var plainText = decipher.read()
|
||||
var privateKey = xor(derivedHalf1, plainText)
|
||||
|
||||
// verify salt matches address
|
||||
var d = BigInteger.fromBuffer(privateKey)
|
||||
var address = getAddress(d, compressed)
|
||||
var checksum = hash256(address).slice(0, 4)
|
||||
assert.deepStrictEqual(salt, checksum)
|
||||
|
||||
return {
|
||||
privateKey: privateKey,
|
||||
compressed: compressed
|
||||
}
|
||||
}
|
||||
|
||||
function decrypt (string, passphrase, progressCallback, scryptParams) {
|
||||
return decryptRaw(bs58check.decode(string), passphrase, progressCallback, scryptParams)
|
||||
}
|
||||
|
||||
function decryptECMult (buffer, passphrase, progressCallback, scryptParams) {
|
||||
passphrase = Buffer.from(passphrase, 'utf8')
|
||||
buffer = buffer.slice(1) // FIXME: we can avoid this
|
||||
scryptParams = scryptParams || SCRYPT_PARAMS
|
||||
|
||||
var flag = buffer.readUInt8(1)
|
||||
var compressed = (flag & 0x20) !== 0
|
||||
var hasLotSeq = (flag & 0x04) !== 0
|
||||
|
||||
assert.strictEqual((flag & 0x24), flag, 'Invalid private key.')
|
||||
|
||||
var addressHash = buffer.slice(2, 6)
|
||||
var ownerEntropy = buffer.slice(6, 14)
|
||||
var ownerSalt
|
||||
|
||||
// 4 bytes ownerSalt if 4 bytes lot/sequence
|
||||
if (hasLotSeq) {
|
||||
ownerSalt = ownerEntropy.slice(0, 4)
|
||||
|
||||
// else, 8 bytes ownerSalt
|
||||
} else {
|
||||
ownerSalt = ownerEntropy
|
||||
}
|
||||
|
||||
var encryptedPart1 = buffer.slice(14, 22) // First 8 bytes
|
||||
var encryptedPart2 = buffer.slice(22, 38) // 16 bytes
|
||||
|
||||
var N = scryptParams.N
|
||||
var r = scryptParams.r
|
||||
var p = scryptParams.p
|
||||
var preFactor = scrypt(passphrase, ownerSalt, N, r, p, 32, progressCallback)
|
||||
|
||||
var passFactor
|
||||
if (hasLotSeq) {
|
||||
var hashTarget = Buffer.concat([preFactor, ownerEntropy])
|
||||
passFactor = hash256(hashTarget)
|
||||
} else {
|
||||
passFactor = preFactor
|
||||
}
|
||||
|
||||
var passInt = BigInteger.fromBuffer(passFactor)
|
||||
var passPoint = curve.G.multiply(passInt).getEncoded(true)
|
||||
|
||||
var seedBPass = scrypt(passPoint, Buffer.concat([addressHash, ownerEntropy]), 1024, 1, 1, 64)
|
||||
var derivedHalf1 = seedBPass.slice(0, 32)
|
||||
var derivedHalf2 = seedBPass.slice(32, 64)
|
||||
|
||||
var decipher = aes.createDecipheriv('aes-256-ecb', derivedHalf2, Buffer.alloc(0))
|
||||
decipher.setAutoPadding(false)
|
||||
decipher.end(encryptedPart2)
|
||||
|
||||
var decryptedPart2 = decipher.read()
|
||||
var tmp = xor(decryptedPart2, derivedHalf1.slice(16, 32))
|
||||
var seedBPart2 = tmp.slice(8, 16)
|
||||
|
||||
var decipher2 = aes.createDecipheriv('aes-256-ecb', derivedHalf2, Buffer.alloc(0))
|
||||
decipher2.setAutoPadding(false)
|
||||
decipher2.write(encryptedPart1) // first 8 bytes
|
||||
decipher2.end(tmp.slice(0, 8)) // last 8 bytes
|
||||
|
||||
var seedBPart1 = xor(decipher2.read(), derivedHalf1.slice(0, 16))
|
||||
var seedB = Buffer.concat([seedBPart1, seedBPart2], 24)
|
||||
var factorB = BigInteger.fromBuffer(hash256(seedB))
|
||||
|
||||
// d = passFactor * factorB (mod n)
|
||||
var d = passInt.multiply(factorB).mod(curve.n)
|
||||
|
||||
return {
|
||||
privateKey: d.toBuffer(32),
|
||||
compressed: compressed
|
||||
}
|
||||
}
|
||||
|
||||
function verify (string) {
|
||||
var decoded = bs58check.decodeUnsafe(string)
|
||||
if (!decoded) return false
|
||||
|
||||
if (decoded.length !== 39) return false
|
||||
if (decoded.readUInt8(0) !== 0x01) return false
|
||||
|
||||
var type = decoded.readUInt8(1)
|
||||
var flag = decoded.readUInt8(2)
|
||||
|
||||
// encrypted WIF
|
||||
if (type === 0x42) {
|
||||
if (flag !== 0xc0 && flag !== 0xe0) return false
|
||||
|
||||
// EC mult
|
||||
} else if (type === 0x43) {
|
||||
if ((flag & ~0x24)) return false
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
decrypt: decrypt,
|
||||
decryptECMult: decryptECMult,
|
||||
decryptRaw: decryptRaw,
|
||||
encrypt: encrypt,
|
||||
encryptRaw: encryptRaw,
|
||||
verify: verify
|
||||
}
|
||||
38
libs/bitcoinjs-bip38/package.json
Normal file
38
libs/bitcoinjs-bip38/package.json
Normal file
@@ -0,0 +1,38 @@
|
||||
{
|
||||
"name": "bip38",
|
||||
"version": "2.0.2",
|
||||
"description": "BIP38 is a standard process to encrypt Bitcoin and crypto currency private keys that is impervious to brute force attacks thus protecting the user.",
|
||||
"main": "index.js",
|
||||
"keywords": [
|
||||
"bitcoin",
|
||||
"crypto",
|
||||
"cryptography",
|
||||
"litecoin"
|
||||
],
|
||||
"homepage": "http://cryptocoinjs.com/modules/currency/bip38/",
|
||||
"author": "JP Richardson",
|
||||
"dependencies": {
|
||||
"bigi": "^1.2.0",
|
||||
"browserify-aes": "^1.0.1",
|
||||
"bs58check": "<3.0.0",
|
||||
"buffer-xor": "^1.0.2",
|
||||
"create-hash": "^1.1.1",
|
||||
"ecurve": "^1.0.0",
|
||||
"scryptsy": "^2.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
},
|
||||
"repository": {
|
||||
"url": "git@github.com:bitcoinjs/bip38.git",
|
||||
"type": "git"
|
||||
},
|
||||
"scripts": {
|
||||
"browser-test": "mochify --wd -R spec --timeout 100000",
|
||||
"build": "browserify index.js --standalone bitcoinjs-bip38 > /tmp/bitcoinjs-bip38.js",
|
||||
"coverage": "istanbul cover _mocha -- --reporter list test/*.js",
|
||||
"coveralls": "npm run-script coverage && coveralls < coverage/lcov.info",
|
||||
"standard": "standard",
|
||||
"test": "npm run standard && npm run unit",
|
||||
"unit": "mocha --ui bdd --timeout 240000"
|
||||
}
|
||||
}
|
||||
4
libs/bitcoinjs-bip38/readme.md
Normal file
4
libs/bitcoinjs-bip38/readme.md
Normal file
@@ -0,0 +1,4 @@
|
||||
Build (will create a bundle and copy it to /tmp/bitcoinjs-bip38.js):
|
||||
|
||||
npm install
|
||||
npm run build
|
||||
5
libs/bitcoinjs-lib/bitcoinjs-lib.js
Normal file
5
libs/bitcoinjs-lib/bitcoinjs-lib.js
Normal file
@@ -0,0 +1,5 @@
|
||||
let bitcoin = require('bitcoinjs-lib')
|
||||
|
||||
module.exports = {
|
||||
bitcoin
|
||||
}
|
||||
14
libs/bitcoinjs-lib/package.json
Normal file
14
libs/bitcoinjs-lib/package.json
Normal file
@@ -0,0 +1,14 @@
|
||||
{
|
||||
"name": "bitcoinjs-lib",
|
||||
"version": "3.3.2",
|
||||
"scripts": {
|
||||
"build": "browserify bitcoinjs-lib.js --standalone bitcoinjs > /tmp/bitcoinjs-lib.js"
|
||||
},
|
||||
"dependencies": {
|
||||
"bitcoinjs-lib": "3.3.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"browserify": "^16.2.3",
|
||||
"uglify-es": "^3.3.9"
|
||||
}
|
||||
}
|
||||
5
libs/bitcoinjs-lib/readme.md
Normal file
5
libs/bitcoinjs-lib/readme.md
Normal file
@@ -0,0 +1,5 @@
|
||||
Build (will create a bundle and copy it to /tmp/bitcoinjs-lib.js):
|
||||
|
||||
npm install
|
||||
npm run build
|
||||
manually add changes in https://github.com/iancoleman/bip39/commit/0702ecd3520c44cb8016f80329dcb5a3c8df88fc
|
||||
169
libs/combined/index.js
Normal file
169
libs/combined/index.js
Normal file
@@ -0,0 +1,169 @@
|
||||
/* base-x */
|
||||
|
||||
module.exports.basex = require('base-x')
|
||||
|
||||
/* base32 */
|
||||
|
||||
module.exports.base32 = require('base32.js')
|
||||
|
||||
/* bchaddrjs */
|
||||
|
||||
module.exports.bchaddr = require('bchaddrjs')
|
||||
|
||||
/* bchaddrjs slp */
|
||||
|
||||
module.exports.bchaddrSlp = require('bchaddrjs-slp')
|
||||
|
||||
/* bech32 */
|
||||
|
||||
module.exports.bech32 = require('bech32')
|
||||
|
||||
/* biginteger */
|
||||
|
||||
module.exports.BigInteger = require('javascript-biginteger')
|
||||
|
||||
/* bitcoinjs-bip38 */
|
||||
|
||||
module.exports.bip38 = require('bip38')
|
||||
|
||||
/* bip85 */
|
||||
|
||||
module.exports.bip85 = require('bip85')
|
||||
|
||||
/* bitcoinjs-lib */
|
||||
|
||||
module.exports.bitcoin = require('bitcoinjs-lib')
|
||||
|
||||
/* buffer */
|
||||
|
||||
module.exports.buffer = require('buffer');
|
||||
|
||||
/* elastos */
|
||||
// See https://github.com/iancoleman/bip39/pull/368
|
||||
// and https://github.com/johnnynanjiang/Elastos.SDK.Keypair.Javascript/tree/iancoleman-bip39
|
||||
|
||||
module.exports.elastosjs = require('elastos-wallet-js')
|
||||
|
||||
/* ethereum-util */
|
||||
|
||||
module.exports.ethUtil = require('ethereumjs-util')
|
||||
|
||||
/* fast-levenshtein */
|
||||
|
||||
module.exports.levenshtein = require('fast-levenshtein')
|
||||
|
||||
/* groestlcoin */
|
||||
|
||||
module.exports.groestlcoinjs = require('groestlcoinjs-lib')
|
||||
|
||||
/* groestlcoin bip38 */
|
||||
|
||||
module.exports.groestlcoinjsBip38 = require('bip38grs')
|
||||
|
||||
/* kjua qr codes */
|
||||
|
||||
module.exports.kjua = require('kjua')
|
||||
|
||||
/* nebulas */
|
||||
|
||||
try {
|
||||
module.exports.nebulas = require('nebulas')
|
||||
}
|
||||
catch (e) {
|
||||
console.warn("Error loading nebulas library");
|
||||
console.warn(e);
|
||||
};
|
||||
|
||||
/* stellar-util */
|
||||
|
||||
let StellarBase = require('stellar-base');
|
||||
let edHd = require('ed25519-hd-key');
|
||||
module.exports.stellarUtil = {
|
||||
getKeypair: function (path, seed) {
|
||||
const result = edHd.derivePath(path, seed);
|
||||
return StellarBase.Keypair.fromRawEd25519Seed(result.key);
|
||||
},
|
||||
dummyNetwork: {
|
||||
bip32: {public: 0, private: 0},
|
||||
messagePrefix: '',
|
||||
pubKeyHash: 0,
|
||||
scriptHash: 0,
|
||||
wif: 0,
|
||||
},
|
||||
}
|
||||
|
||||
/* zoobc-util */
|
||||
|
||||
let base32 = require('base32.js');
|
||||
let nbl = require('nebulas');
|
||||
module.exports.zoobcUtil = {
|
||||
getKeypair: function (path, seed) {
|
||||
const { key, chainCode} = edHd.derivePath(path, seed);
|
||||
const pubKey = edHd.getPublicKey(key);
|
||||
return {key,chainCode, pubKey};
|
||||
},
|
||||
getZBCAddress(publicKey, prefix = "ZBC") {
|
||||
const prefixDefault = ["ZBC", "ZNK", "ZBL", "ZTX"];
|
||||
const valid = prefixDefault.indexOf(prefix) > -1;
|
||||
if (valid) {
|
||||
var bytes = new Uint8Array(35);
|
||||
for (let i = 0; i < 32; i++) bytes[i] = publicKey[i];
|
||||
for (let i = 0; i < 3; i++) bytes[i + 32] = prefix.charCodeAt(i);
|
||||
const checksum = nbl.CryptoUtils.sha3(bytes);
|
||||
for (let i = 0; i < 3; i++) bytes[i + 32] = Number(checksum[i]);
|
||||
var segs = [prefix];
|
||||
var b32 = base32.encode(bytes);
|
||||
for (let i = 0; i < 7; i++) segs.push(b32.substr(i * 8, 8));
|
||||
return segs.join("_");
|
||||
} else {
|
||||
throw new Error("The Prefix not available!");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* nano-util */
|
||||
|
||||
let NanoBase = require('nanocurrency-web');
|
||||
module.exports.nanoUtil = {
|
||||
getKeypair: function (index, seed) {
|
||||
const accounts = NanoBase.wallet.accounts(seed, index, index)
|
||||
return {privKey: accounts[0].privateKey, pubKey: accounts[0].publicKey, address: accounts[0].address};
|
||||
},
|
||||
dummyNetwork: {
|
||||
bip32: {public: 0, private: 0},
|
||||
messagePrefix: '',
|
||||
pubKeyHash: 0,
|
||||
scriptHash: 0,
|
||||
wif: 0,
|
||||
},
|
||||
}
|
||||
|
||||
/* unorm */
|
||||
|
||||
module.exports.unorm = require('unorm')
|
||||
|
||||
/* zxcvbn */
|
||||
|
||||
module.exports.zxcvbn = require('zxcvbn')
|
||||
|
||||
/* handshake */
|
||||
module.exports.handshake = require('handshake-util')
|
||||
|
||||
/* bs58 */
|
||||
try {
|
||||
module.exports.bs58 = require('bs58')
|
||||
}
|
||||
catch (e) {
|
||||
console.warn("Error loading bs58 library");
|
||||
console.warn(e);
|
||||
};
|
||||
|
||||
/* create-hash */
|
||||
try {
|
||||
module.exports.createHash = require('create-hash')
|
||||
}
|
||||
catch (e) {
|
||||
console.warn("Error loading create-hash library");
|
||||
console.warn(e);
|
||||
};
|
||||
|
||||
5314
libs/combined/package-lock.json
generated
Normal file
5314
libs/combined/package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
38
libs/combined/package.json
Normal file
38
libs/combined/package.json
Normal file
@@ -0,0 +1,38 @@
|
||||
{
|
||||
"name": "bip39-tool-external-libs",
|
||||
"version": "0.4.0",
|
||||
"scripts": {
|
||||
"build": "browserify index.js --standalone libs | uglifyjs -c > ../../src/js/bip39-libs.js"
|
||||
},
|
||||
"dependencies": {
|
||||
"base-x": "3.0.7",
|
||||
"bchaddrjs": "0.4.4",
|
||||
"bchaddrjs-slp": "git://github.com/simpleledger/bchaddrjs.git#af16e44a6bfbe4b3980a62dba50e2f68ed864c6b",
|
||||
"bech32": "1.1.4",
|
||||
"bip38": "2.0.2",
|
||||
"bip38grs": "git://github.com/Groestlcoin/bip38grs.git#091975b01679b74dc0a4136bb743fe17791b0151",
|
||||
"bip85": "0.0.3",
|
||||
"bitcoinjs-lib": "git://github.com/iancoleman/bitcoinjs-lib.git#v3.3.2_16bit",
|
||||
"bs58": "^4.0.1",
|
||||
"buffer": "^5.4.3",
|
||||
"create-hash": "^1.2.0",
|
||||
"ed25519-hd-key": "^1.0.0",
|
||||
"elastos-wallet-js": "git://github.com/johnnynanjiang/Elastos.SDK.Keypair.Javascript.git#491dc51b64efaf0a8aae62028b68e2c8e38fde06",
|
||||
"ethereumjs-util": "6.0.0",
|
||||
"fast-levenshtein": "2.0.6",
|
||||
"groestlcoinjs-lib": "git://github.com/Groestlcoin/groestlcoinjs-lib.git#3.3.2",
|
||||
"handshake-util": "1.2.0",
|
||||
"javascript-biginteger": "0.9.2",
|
||||
"jsrsasign": "^8.0.19",
|
||||
"kjua": "0.6.0",
|
||||
"nanocurrency-web": "^1.2.2",
|
||||
"nebulas": "0.5.6",
|
||||
"stellar-base": "^0.10.0",
|
||||
"unorm": "1.6.0",
|
||||
"zxcvbn": "4.4.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"browserify": "^16.2.3",
|
||||
"uglify-es": "^3.3.9"
|
||||
}
|
||||
}
|
||||
6
libs/combined/readme.md
Normal file
6
libs/combined/readme.md
Normal file
@@ -0,0 +1,6 @@
|
||||
# Generate libs
|
||||
|
||||
```
|
||||
npm install --no-optional
|
||||
npm run build
|
||||
```
|
||||
736
libs/ethereumjs-util/index.js
Normal file
736
libs/ethereumjs-util/index.js
Normal file
@@ -0,0 +1,736 @@
|
||||
const createKeccakHash = require('keccak')
|
||||
const secp256k1 = require('secp256k1')
|
||||
const assert = require('assert')
|
||||
const rlp = require('rlp')
|
||||
const BN = require('bn.js')
|
||||
const createHash = require('create-hash')
|
||||
const Buffer = require('safe-buffer').Buffer
|
||||
Object.assign(exports, require('ethjs-util'))
|
||||
|
||||
/**
|
||||
* the max integer that this VM can handle (a ```BN```)
|
||||
* @var {BN} MAX_INTEGER
|
||||
*/
|
||||
exports.MAX_INTEGER = new BN('ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff', 16)
|
||||
|
||||
/**
|
||||
* 2^256 (a ```BN```)
|
||||
* @var {BN} TWO_POW256
|
||||
*/
|
||||
exports.TWO_POW256 = new BN('10000000000000000000000000000000000000000000000000000000000000000', 16)
|
||||
|
||||
/**
|
||||
* Keccak-256 hash of null (a ```String```)
|
||||
* @var {String} KECCAK256_NULL_S
|
||||
*/
|
||||
exports.KECCAK256_NULL_S = 'c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470'
|
||||
|
||||
/**
|
||||
* Keccak-256 hash of null (a ```Buffer```)
|
||||
* @var {Buffer} KECCAK256_NULL
|
||||
*/
|
||||
exports.KECCAK256_NULL = Buffer.from(exports.KECCAK256_NULL_S, 'hex')
|
||||
|
||||
/**
|
||||
* Keccak-256 of an RLP of an empty array (a ```String```)
|
||||
* @var {String} KECCAK256_RLP_ARRAY_S
|
||||
*/
|
||||
exports.KECCAK256_RLP_ARRAY_S = '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347'
|
||||
|
||||
/**
|
||||
* Keccak-256 of an RLP of an empty array (a ```Buffer```)
|
||||
* @var {Buffer} KECCAK256_RLP_ARRAY
|
||||
*/
|
||||
exports.KECCAK256_RLP_ARRAY = Buffer.from(exports.KECCAK256_RLP_ARRAY_S, 'hex')
|
||||
|
||||
/**
|
||||
* Keccak-256 hash of the RLP of null (a ```String```)
|
||||
* @var {String} KECCAK256_RLP_S
|
||||
*/
|
||||
exports.KECCAK256_RLP_S = '56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421'
|
||||
|
||||
/**
|
||||
* Keccak-256 hash of the RLP of null (a ```Buffer```)
|
||||
* @var {Buffer} KECCAK256_RLP
|
||||
*/
|
||||
exports.KECCAK256_RLP = Buffer.from(exports.KECCAK256_RLP_S, 'hex')
|
||||
|
||||
/**
|
||||
* [`BN`](https://github.com/indutny/bn.js)
|
||||
* @var {Function}
|
||||
*/
|
||||
exports.BN = BN
|
||||
|
||||
/**
|
||||
* [`rlp`](https://github.com/ethereumjs/rlp)
|
||||
* @var {Function}
|
||||
*/
|
||||
exports.rlp = rlp
|
||||
|
||||
/**
|
||||
* [`secp256k1`](https://github.com/cryptocoinjs/secp256k1-node/)
|
||||
* @var {Object}
|
||||
*/
|
||||
exports.secp256k1 = secp256k1
|
||||
|
||||
/**
|
||||
* Returns a buffer filled with 0s
|
||||
* @method zeros
|
||||
* @param {Number} bytes the number of bytes the buffer should be
|
||||
* @return {Buffer}
|
||||
*/
|
||||
exports.zeros = function (bytes) {
|
||||
return Buffer.allocUnsafe(bytes).fill(0)
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a zero address
|
||||
* @method zeroAddress
|
||||
* @return {String}
|
||||
*/
|
||||
exports.zeroAddress = function () {
|
||||
const addressLength = 20
|
||||
const zeroAddress = exports.zeros(addressLength)
|
||||
return exports.bufferToHex(zeroAddress)
|
||||
}
|
||||
|
||||
/**
|
||||
* Left Pads an `Array` or `Buffer` with leading zeros till it has `length` bytes.
|
||||
* Or it truncates the beginning if it exceeds.
|
||||
* @method lsetLength
|
||||
* @param {Buffer|Array} msg the value to pad
|
||||
* @param {Number} length the number of bytes the output should be
|
||||
* @param {Boolean} [right=false] whether to start padding form the left or right
|
||||
* @return {Buffer|Array}
|
||||
*/
|
||||
exports.setLengthLeft = exports.setLength = function (msg, length, right) {
|
||||
const buf = exports.zeros(length)
|
||||
msg = exports.toBuffer(msg)
|
||||
if (right) {
|
||||
if (msg.length < length) {
|
||||
msg.copy(buf)
|
||||
return buf
|
||||
}
|
||||
return msg.slice(0, length)
|
||||
} else {
|
||||
if (msg.length < length) {
|
||||
msg.copy(buf, length - msg.length)
|
||||
return buf
|
||||
}
|
||||
return msg.slice(-length)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Right Pads an `Array` or `Buffer` with leading zeros till it has `length` bytes.
|
||||
* Or it truncates the beginning if it exceeds.
|
||||
* @param {Buffer|Array} msg the value to pad
|
||||
* @param {Number} length the number of bytes the output should be
|
||||
* @return {Buffer|Array}
|
||||
*/
|
||||
exports.setLengthRight = function (msg, length) {
|
||||
return exports.setLength(msg, length, true)
|
||||
}
|
||||
|
||||
/**
|
||||
* Trims leading zeros from a `Buffer` or an `Array`
|
||||
* @param {Buffer|Array|String} a
|
||||
* @return {Buffer|Array|String}
|
||||
*/
|
||||
exports.unpad = exports.stripZeros = function (a) {
|
||||
a = exports.stripHexPrefix(a)
|
||||
let first = a[0]
|
||||
while (a.length > 0 && first.toString() === '0') {
|
||||
a = a.slice(1)
|
||||
first = a[0]
|
||||
}
|
||||
return a
|
||||
}
|
||||
/**
|
||||
* Attempts to turn a value into a `Buffer`. As input it supports `Buffer`, `String`, `Number`, null/undefined, `BN` and other objects with a `toArray()` method.
|
||||
* @param {*} v the value
|
||||
*/
|
||||
exports.toBuffer = function (v) {
|
||||
if (!Buffer.isBuffer(v)) {
|
||||
if (Array.isArray(v)) {
|
||||
v = Buffer.from(v)
|
||||
} else if (typeof v === 'string') {
|
||||
if (exports.isHexString(v)) {
|
||||
v = Buffer.from(exports.padToEven(exports.stripHexPrefix(v)), 'hex')
|
||||
} else {
|
||||
v = Buffer.from(v)
|
||||
}
|
||||
} else if (typeof v === 'number') {
|
||||
v = exports.intToBuffer(v)
|
||||
} else if (v === null || v === undefined) {
|
||||
v = Buffer.allocUnsafe(0)
|
||||
} else if (BN.isBN(v)) {
|
||||
v = v.toArrayLike(Buffer)
|
||||
} else if (v.toArray) {
|
||||
// converts a BN to a Buffer
|
||||
v = Buffer.from(v.toArray())
|
||||
} else {
|
||||
throw new Error('invalid type')
|
||||
}
|
||||
}
|
||||
return v
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts a `Buffer` to a `Number`
|
||||
* @param {Buffer} buf
|
||||
* @return {Number}
|
||||
* @throws If the input number exceeds 53 bits.
|
||||
*/
|
||||
exports.bufferToInt = function (buf) {
|
||||
return new BN(exports.toBuffer(buf)).toNumber()
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts a `Buffer` into a hex `String`
|
||||
* @param {Buffer} buf
|
||||
* @return {String}
|
||||
*/
|
||||
exports.bufferToHex = function (buf) {
|
||||
buf = exports.toBuffer(buf)
|
||||
return '0x' + buf.toString('hex')
|
||||
}
|
||||
|
||||
/**
|
||||
* Interprets a `Buffer` as a signed integer and returns a `BN`. Assumes 256-bit numbers.
|
||||
* @param {Buffer} num
|
||||
* @return {BN}
|
||||
*/
|
||||
exports.fromSigned = function (num) {
|
||||
return new BN(num).fromTwos(256)
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts a `BN` to an unsigned integer and returns it as a `Buffer`. Assumes 256-bit numbers.
|
||||
* @param {BN} num
|
||||
* @return {Buffer}
|
||||
*/
|
||||
exports.toUnsigned = function (num) {
|
||||
return Buffer.from(num.toTwos(256).toArray())
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates Keccak hash of the input
|
||||
* @param {Buffer|Array|String|Number} a the input data
|
||||
* @param {Number} [bits=256] the Keccak width
|
||||
* @return {Buffer}
|
||||
*/
|
||||
exports.keccak = function (a, bits) {
|
||||
a = exports.toBuffer(a)
|
||||
if (!bits) bits = 256
|
||||
|
||||
return createKeccakHash('keccak' + bits).update(a).digest()
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates Keccak-256 hash of the input, alias for keccak(a, 256)
|
||||
* @param {Buffer|Array|String|Number} a the input data
|
||||
* @return {Buffer}
|
||||
*/
|
||||
exports.keccak256 = function (a) {
|
||||
return exports.keccak(a)
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates SHA256 hash of the input
|
||||
* @param {Buffer|Array|String|Number} a the input data
|
||||
* @return {Buffer}
|
||||
*/
|
||||
exports.sha256 = function (a) {
|
||||
a = exports.toBuffer(a)
|
||||
return createHash('sha256').update(a).digest()
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates RIPEMD160 hash of the input
|
||||
* @param {Buffer|Array|String|Number} a the input data
|
||||
* @param {Boolean} padded whether it should be padded to 256 bits or not
|
||||
* @return {Buffer}
|
||||
*/
|
||||
exports.ripemd160 = function (a, padded) {
|
||||
a = exports.toBuffer(a)
|
||||
const hash = createHash('rmd160').update(a).digest()
|
||||
if (padded === true) {
|
||||
return exports.setLength(hash, 32)
|
||||
} else {
|
||||
return hash
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates SHA-3 hash of the RLP encoded version of the input
|
||||
* @param {Buffer|Array|String|Number} a the input data
|
||||
* @return {Buffer}
|
||||
*/
|
||||
exports.rlphash = function (a) {
|
||||
return exports.keccak(rlp.encode(a))
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the private key satisfies the rules of the curve secp256k1.
|
||||
* @param {Buffer} privateKey
|
||||
* @return {Boolean}
|
||||
*/
|
||||
exports.isValidPrivate = function (privateKey) {
|
||||
return secp256k1.privateKeyVerify(privateKey)
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the public key satisfies the rules of the curve secp256k1
|
||||
* and the requirements of Ethereum.
|
||||
* @param {Buffer} publicKey The two points of an uncompressed key, unless sanitize is enabled
|
||||
* @param {Boolean} [sanitize=false] Accept public keys in other formats
|
||||
* @return {Boolean}
|
||||
*/
|
||||
exports.isValidPublic = function (publicKey, sanitize) {
|
||||
if (publicKey.length === 64) {
|
||||
// Convert to SEC1 for secp256k1
|
||||
return secp256k1.publicKeyVerify(Buffer.concat([ Buffer.from([4]), publicKey ]))
|
||||
}
|
||||
|
||||
if (!sanitize) {
|
||||
return false
|
||||
}
|
||||
|
||||
return secp256k1.publicKeyVerify(publicKey)
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the ethereum address of a given public key.
|
||||
* Accepts "Ethereum public keys" and SEC1 encoded keys.
|
||||
* @param {Buffer} pubKey The two points of an uncompressed key, unless sanitize is enabled
|
||||
* @param {Boolean} [sanitize=false] Accept public keys in other formats
|
||||
* @return {Buffer}
|
||||
*/
|
||||
exports.pubToAddress = exports.publicToAddress = function (pubKey, sanitize) {
|
||||
pubKey = exports.toBuffer(pubKey)
|
||||
if (sanitize && (pubKey.length !== 64)) {
|
||||
pubKey = secp256k1.publicKeyConvert(pubKey, false).slice(1)
|
||||
}
|
||||
assert(pubKey.length === 64)
|
||||
// Only take the lower 160bits of the hash
|
||||
return exports.keccak(pubKey).slice(-20)
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the ethereum public key of a given private key
|
||||
* @param {Buffer} privateKey A private key must be 256 bits wide
|
||||
* @return {Buffer}
|
||||
*/
|
||||
const privateToPublic = exports.privateToPublic = function (privateKey) {
|
||||
privateKey = exports.toBuffer(privateKey)
|
||||
// skip the type flag and use the X, Y points
|
||||
return secp256k1.publicKeyCreate(privateKey, false).slice(1)
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts a public key to the Ethereum format.
|
||||
* @param {Buffer} publicKey
|
||||
* @return {Buffer}
|
||||
*/
|
||||
exports.importPublic = function (publicKey) {
|
||||
publicKey = exports.toBuffer(publicKey)
|
||||
if (publicKey.length !== 64) {
|
||||
publicKey = secp256k1.publicKeyConvert(publicKey, false).slice(1)
|
||||
}
|
||||
return publicKey
|
||||
}
|
||||
|
||||
/**
|
||||
* ECDSA sign
|
||||
* @param {Buffer} msgHash
|
||||
* @param {Buffer} privateKey
|
||||
* @param {Number} [chainId]
|
||||
* @return {Object}
|
||||
*/
|
||||
exports.ecsign = function (msgHash, privateKey, chainId) {
|
||||
const sig = secp256k1.sign(msgHash, privateKey)
|
||||
|
||||
const ret = {}
|
||||
ret.r = sig.signature.slice(0, 32)
|
||||
ret.s = sig.signature.slice(32, 64)
|
||||
ret.v = chainId ? sig.recovery + (chainId * 2 + 35) : sig.recovery + 27
|
||||
return ret
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the keccak-256 hash of `message`, prefixed with the header used by the `eth_sign` RPC call.
|
||||
* The output of this function can be fed into `ecsign` to produce the same signature as the `eth_sign`
|
||||
* call for a given `message`, or fed to `ecrecover` along with a signature to recover the public key
|
||||
* used to produce the signature.
|
||||
* @param message
|
||||
* @returns {Buffer} hash
|
||||
*/
|
||||
exports.hashPersonalMessage = function (message) {
|
||||
const prefix = exports.toBuffer('\u0019Ethereum Signed Message:\n' + message.length.toString())
|
||||
return exports.keccak(Buffer.concat([prefix, message]))
|
||||
}
|
||||
|
||||
/**
|
||||
* ECDSA public key recovery from signature
|
||||
* @param {Buffer} msgHash
|
||||
* @param {Number} v
|
||||
* @param {Buffer} r
|
||||
* @param {Buffer} s
|
||||
* @param {Number} [chainId]
|
||||
* @return {Buffer} publicKey
|
||||
*/
|
||||
exports.ecrecover = function (msgHash, v, r, s, chainId) {
|
||||
const signature = Buffer.concat([exports.setLength(r, 32), exports.setLength(s, 32)], 64)
|
||||
const recovery = calculateSigRecovery(v, chainId)
|
||||
if (!isValidSigRecovery(recovery)) {
|
||||
throw new Error('Invalid signature v value')
|
||||
}
|
||||
const senderPubKey = secp256k1.recover(msgHash, signature, recovery)
|
||||
return secp256k1.publicKeyConvert(senderPubKey, false).slice(1)
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert signature parameters into the format of `eth_sign` RPC method
|
||||
* @param {Number} v
|
||||
* @param {Buffer} r
|
||||
* @param {Buffer} s
|
||||
* @param {Number} [chainId]
|
||||
* @return {String} sig
|
||||
*/
|
||||
exports.toRpcSig = function (v, r, s, chainId) {
|
||||
let recovery = calculateSigRecovery(v, chainId)
|
||||
if (!isValidSigRecovery(recovery)) {
|
||||
throw new Error('Invalid signature v value')
|
||||
}
|
||||
|
||||
// geth (and the RPC eth_sign method) uses the 65 byte format used by Bitcoin
|
||||
return exports.bufferToHex(Buffer.concat([
|
||||
exports.setLengthLeft(r, 32),
|
||||
exports.setLengthLeft(s, 32),
|
||||
exports.toBuffer(v)
|
||||
]))
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert signature format of the `eth_sign` RPC method to signature parameters
|
||||
* NOTE: all because of a bug in geth: https://github.com/ethereum/go-ethereum/issues/2053
|
||||
* @param {String} sig
|
||||
* @return {Object}
|
||||
*/
|
||||
exports.fromRpcSig = function (sig) {
|
||||
sig = exports.toBuffer(sig)
|
||||
|
||||
// NOTE: with potential introduction of chainId this might need to be updated
|
||||
if (sig.length !== 65) {
|
||||
throw new Error('Invalid signature length')
|
||||
}
|
||||
|
||||
let v = sig[64]
|
||||
// support both versions of `eth_sign` responses
|
||||
if (v < 27) {
|
||||
v += 27
|
||||
}
|
||||
|
||||
return {
|
||||
v: v,
|
||||
r: sig.slice(0, 32),
|
||||
s: sig.slice(32, 64)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the ethereum address of a given private key
|
||||
* @param {Buffer} privateKey A private key must be 256 bits wide
|
||||
* @return {Buffer}
|
||||
*/
|
||||
exports.privateToAddress = function (privateKey) {
|
||||
return exports.publicToAddress(privateToPublic(privateKey))
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the address is a valid. Accepts checksummed addresses too
|
||||
* @param {String} address
|
||||
* @return {Boolean}
|
||||
*/
|
||||
exports.isValidAddress = function (address) {
|
||||
return /^0x[0-9a-fA-F]{40}$/.test(address)
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if a given address is a zero address
|
||||
* @method isZeroAddress
|
||||
* @param {String} address
|
||||
* @return {Boolean}
|
||||
*/
|
||||
exports.isZeroAddress = function (address) {
|
||||
const zeroAddress = exports.zeroAddress()
|
||||
return zeroAddress === exports.addHexPrefix(address)
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a checksummed address
|
||||
* @param {String} address
|
||||
* @return {String}
|
||||
*/
|
||||
exports.toChecksumAddress = function (address) {
|
||||
address = exports.stripHexPrefix(address).toLowerCase()
|
||||
const hash = exports.keccak(address).toString('hex')
|
||||
let ret = '0x'
|
||||
|
||||
for (let i = 0; i < address.length; i++) {
|
||||
if (parseInt(hash[i], 16) >= 8) {
|
||||
ret += address[i].toUpperCase()
|
||||
} else {
|
||||
ret += address[i]
|
||||
}
|
||||
}
|
||||
|
||||
return ret
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the address is a valid checksummed address
|
||||
* @param {Buffer} address
|
||||
* @return {Boolean}
|
||||
*/
|
||||
exports.isValidChecksumAddress = function (address) {
|
||||
return exports.isValidAddress(address) && (exports.toChecksumAddress(address) === address)
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates an address of a newly created contract
|
||||
* @param {Buffer} from the address which is creating this new address
|
||||
* @param {Buffer} nonce the nonce of the from account
|
||||
* @return {Buffer}
|
||||
*/
|
||||
exports.generateAddress = function (from, nonce) {
|
||||
from = exports.toBuffer(from)
|
||||
nonce = new BN(nonce)
|
||||
|
||||
if (nonce.isZero()) {
|
||||
// in RLP we want to encode null in the case of zero nonce
|
||||
// read the RLP documentation for an answer if you dare
|
||||
nonce = null
|
||||
} else {
|
||||
nonce = Buffer.from(nonce.toArray())
|
||||
}
|
||||
|
||||
// Only take the lower 160bits of the hash
|
||||
return exports.rlphash([from, nonce]).slice(-20)
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates an address for a contract created using CREATE2
|
||||
* @param {Buffer} from the address which is creating this new address
|
||||
* @param {Buffer} salt a salt
|
||||
* @param {Buffer} initCode the init code of the contract being created
|
||||
* @return {Buffer}
|
||||
*/
|
||||
exports.generateAddress2 = function (from, salt, initCode) {
|
||||
from = exports.toBuffer(from)
|
||||
salt = exports.toBuffer(salt)
|
||||
initCode = exports.toBuffer(initCode)
|
||||
|
||||
assert(from.length === 20)
|
||||
assert(salt.length === 32)
|
||||
|
||||
let address = exports.keccak256(Buffer.concat([
|
||||
Buffer.from('ff', 'hex'),
|
||||
from,
|
||||
salt,
|
||||
exports.keccak256(initCode)
|
||||
]))
|
||||
|
||||
return address.slice(-20)
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if the supplied address belongs to a precompiled account (Byzantium)
|
||||
* @param {Buffer|String} address
|
||||
* @return {Boolean}
|
||||
*/
|
||||
exports.isPrecompiled = function (address) {
|
||||
const a = exports.unpad(address)
|
||||
return a.length === 1 && a[0] >= 1 && a[0] <= 8
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds "0x" to a given `String` if it does not already start with "0x"
|
||||
* @param {String} str
|
||||
* @return {String}
|
||||
*/
|
||||
exports.addHexPrefix = function (str) {
|
||||
if (typeof str !== 'string') {
|
||||
return str
|
||||
}
|
||||
|
||||
return exports.isHexPrefixed(str) ? str : '0x' + str
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate ECDSA signature
|
||||
* @method isValidSignature
|
||||
* @param {Buffer} v
|
||||
* @param {Buffer} r
|
||||
* @param {Buffer} s
|
||||
* @param {Boolean} [homestead=true]
|
||||
* @param {Number} [chainId]
|
||||
* @return {Boolean}
|
||||
*/
|
||||
|
||||
exports.isValidSignature = function (v, r, s, homestead, chainId) {
|
||||
const SECP256K1_N_DIV_2 = new BN('7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0', 16)
|
||||
const SECP256K1_N = new BN('fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141', 16)
|
||||
|
||||
if (r.length !== 32 || s.length !== 32) {
|
||||
return false
|
||||
}
|
||||
|
||||
if (!isValidSigRecovery(calculateSigRecovery(v, chainId))) {
|
||||
return false
|
||||
}
|
||||
|
||||
r = new BN(r)
|
||||
s = new BN(s)
|
||||
|
||||
if (r.isZero() || r.gt(SECP256K1_N) || s.isZero() || s.gt(SECP256K1_N)) {
|
||||
return false
|
||||
}
|
||||
|
||||
if ((homestead === false) && (new BN(s).cmp(SECP256K1_N_DIV_2) === 1)) {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts a `Buffer` or `Array` to JSON
|
||||
* @param {Buffer|Array} ba
|
||||
* @return {Array|String|null}
|
||||
*/
|
||||
exports.baToJSON = function (ba) {
|
||||
if (Buffer.isBuffer(ba)) {
|
||||
return '0x' + ba.toString('hex')
|
||||
} else if (ba instanceof Array) {
|
||||
const array = []
|
||||
for (let i = 0; i < ba.length; i++) {
|
||||
array.push(exports.baToJSON(ba[i]))
|
||||
}
|
||||
return array
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Defines properties on a `Object`. It make the assumption that underlying data is binary.
|
||||
* @param {Object} self the `Object` to define properties on
|
||||
* @param {Array} fields an array fields to define. Fields can contain:
|
||||
* * `name` - the name of the properties
|
||||
* * `length` - the number of bytes the field can have
|
||||
* * `allowLess` - if the field can be less than the length
|
||||
* * `allowEmpty`
|
||||
* @param {*} data data to be validated against the definitions
|
||||
*/
|
||||
exports.defineProperties = function (self, fields, data) {
|
||||
self.raw = []
|
||||
self._fields = []
|
||||
|
||||
// attach the `toJSON`
|
||||
self.toJSON = function (label) {
|
||||
if (label) {
|
||||
const obj = {}
|
||||
self._fields.forEach((field) => {
|
||||
obj[field] = '0x' + self[field].toString('hex')
|
||||
})
|
||||
return obj
|
||||
}
|
||||
return exports.baToJSON(this.raw)
|
||||
}
|
||||
|
||||
self.serialize = function serialize () {
|
||||
return rlp.encode(self.raw)
|
||||
}
|
||||
|
||||
fields.forEach((field, i) => {
|
||||
self._fields.push(field.name)
|
||||
function getter () {
|
||||
return self.raw[i]
|
||||
}
|
||||
function setter (v) {
|
||||
v = exports.toBuffer(v)
|
||||
|
||||
if (v.toString('hex') === '00' && !field.allowZero) {
|
||||
v = Buffer.allocUnsafe(0)
|
||||
}
|
||||
|
||||
if (field.allowLess && field.length) {
|
||||
v = exports.stripZeros(v)
|
||||
assert(field.length >= v.length, 'The field ' + field.name + ' must not have more ' + field.length + ' bytes')
|
||||
} else if (!(field.allowZero && v.length === 0) && field.length) {
|
||||
assert(field.length === v.length, 'The field ' + field.name + ' must have byte length of ' + field.length)
|
||||
}
|
||||
|
||||
self.raw[i] = v
|
||||
}
|
||||
|
||||
Object.defineProperty(self, field.name, {
|
||||
enumerable: true,
|
||||
configurable: true,
|
||||
get: getter,
|
||||
set: setter
|
||||
})
|
||||
|
||||
if (field.default) {
|
||||
self[field.name] = field.default
|
||||
}
|
||||
|
||||
// attach alias
|
||||
if (field.alias) {
|
||||
Object.defineProperty(self, field.alias, {
|
||||
enumerable: false,
|
||||
configurable: true,
|
||||
set: setter,
|
||||
get: getter
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
// if the constuctor is passed data
|
||||
if (data) {
|
||||
if (typeof data === 'string') {
|
||||
data = Buffer.from(exports.stripHexPrefix(data), 'hex')
|
||||
}
|
||||
|
||||
if (Buffer.isBuffer(data)) {
|
||||
data = rlp.decode(data)
|
||||
}
|
||||
|
||||
if (Array.isArray(data)) {
|
||||
if (data.length > self._fields.length) {
|
||||
throw (new Error('wrong number of fields in data'))
|
||||
}
|
||||
|
||||
// make sure all the items are buffers
|
||||
data.forEach((d, i) => {
|
||||
self[self._fields[i]] = exports.toBuffer(d)
|
||||
})
|
||||
} else if (typeof data === 'object') {
|
||||
const keys = Object.keys(data)
|
||||
fields.forEach((field) => {
|
||||
if (keys.indexOf(field.name) !== -1) self[field.name] = data[field.name]
|
||||
if (keys.indexOf(field.alias) !== -1) self[field.alias] = data[field.alias]
|
||||
})
|
||||
} else {
|
||||
throw new Error('invalid data')
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function calculateSigRecovery (v, chainId) {
|
||||
return chainId ? v - (2 * chainId + 35) : v - 27
|
||||
}
|
||||
|
||||
function isValidSigRecovery (recovery) {
|
||||
return recovery === 0 || recovery === 1
|
||||
}
|
||||
125
libs/ethereumjs-util/package.json
Normal file
125
libs/ethereumjs-util/package.json
Normal file
@@ -0,0 +1,125 @@
|
||||
{
|
||||
"name": "ethereumjs-util",
|
||||
"version": "6.0.0",
|
||||
"description": "a collection of utility functions for Ethereum",
|
||||
"main": "dist/index.js",
|
||||
"files": [
|
||||
"dist"
|
||||
],
|
||||
"scripts": {
|
||||
"build": "browserify index.js -s ethUtil -o /tmp/ethereumjs-util.js",
|
||||
"coverage": "npm run build:dist && istanbul cover _mocha",
|
||||
"coveralls": "npm run coverage && coveralls <coverage/lcov.info",
|
||||
"lint": "standard",
|
||||
"prepublishOnly": "npm run test && npm run build:dist",
|
||||
"test": "npm run lint && npm run test:node && npm run test:browser",
|
||||
"test:browser": "npm run build:dist && karma start karma.conf.js",
|
||||
"test:node": "npm run build:dist && istanbul test mocha -- --reporter spec",
|
||||
"build:dist": "babel index.js --source-root ./ -d ./dist",
|
||||
"build:docs": "documentation build ./index.js --github --sort-order='alpha' -f md > ./docs/index.md"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/ethereumjs/ethereumjs-util.git"
|
||||
},
|
||||
"keywords": [
|
||||
"ethereum",
|
||||
"utilties"
|
||||
],
|
||||
"author": "mjbecze <mjbecze@gmail.com>",
|
||||
"contributors": [
|
||||
{
|
||||
"name": "Tim Coulter",
|
||||
"email": "tim@timothyjcoulter.com",
|
||||
"url": "https://github.com/tcoulter",
|
||||
"contributions": 1,
|
||||
"additions": 2,
|
||||
"deletions": 2
|
||||
},
|
||||
{
|
||||
"name": "Nick Dodson",
|
||||
"url": "https://github.com/SilentCicero",
|
||||
"contributions": 2,
|
||||
"additions": 26,
|
||||
"deletions": 2
|
||||
},
|
||||
{
|
||||
"name": "Mr. Chico",
|
||||
"url": "https://github.com/MrChico",
|
||||
"contributions": 1,
|
||||
"additions": 11,
|
||||
"deletions": 1
|
||||
},
|
||||
{
|
||||
"name": "Dũng Trần",
|
||||
"email": "tad88.dev@gmail.com",
|
||||
"url": "https://github.com/tad88dev",
|
||||
"contributions": 2,
|
||||
"additions": 5,
|
||||
"deletions": 5
|
||||
},
|
||||
{
|
||||
"name": "Alex Beregszaszi",
|
||||
"email": "alex@rtfs.hu",
|
||||
"url": "https://github.com/axic",
|
||||
"contributions": 77,
|
||||
"additions": 1796,
|
||||
"deletions": 642
|
||||
},
|
||||
{
|
||||
"name": "Taylor Gerring",
|
||||
"url": "https://github.com/tgerring",
|
||||
"contributions": 1,
|
||||
"additions": 1,
|
||||
"deletions": 1
|
||||
},
|
||||
{
|
||||
"name": "Kirill Fomichev",
|
||||
"email": "fanatid@ya.ru",
|
||||
"url": "https://github.com/fanatid",
|
||||
"contributions": 8,
|
||||
"additions": 32,
|
||||
"deletions": 16
|
||||
},
|
||||
{
|
||||
"name": "kumavis",
|
||||
"email": "aaron@kumavis.me",
|
||||
"url": "https://github.com/kumavis",
|
||||
"contributions": 2,
|
||||
"additions": 2,
|
||||
"deletions": 2
|
||||
},
|
||||
{
|
||||
"name": "Alexander Sinyagin",
|
||||
"email": "sinyagin.alexander@gmail.com",
|
||||
"url": "https://github.com/asinyagin",
|
||||
"contributions": 1,
|
||||
"additions": 3,
|
||||
"deletions": 1
|
||||
}
|
||||
],
|
||||
"license": "MPL-2.0",
|
||||
"bugs": {
|
||||
"url": "https://github.com/ethereumjs/ethereumjs-util/issues"
|
||||
},
|
||||
"homepage": "https://github.com/ethereumjs/ethereumjs-util",
|
||||
"dependencies": {
|
||||
"bn.js": "^4.11.0",
|
||||
"create-hash": "^1.1.2",
|
||||
"ethjs-util": "^0.1.6",
|
||||
"keccak": "^1.0.2",
|
||||
"rlp": "^2.0.0",
|
||||
"safe-buffer": "^5.1.1",
|
||||
"secp256k1": "^3.0.1"
|
||||
},
|
||||
"devDependencies": {},
|
||||
"standard": {
|
||||
"globals": [
|
||||
"describe",
|
||||
"it"
|
||||
],
|
||||
"ignore": [
|
||||
"dist/**"
|
||||
]
|
||||
}
|
||||
}
|
||||
4
libs/ethereumjs-util/readme.md
Normal file
4
libs/ethereumjs-util/readme.md
Normal file
@@ -0,0 +1,4 @@
|
||||
Build (will create a bundle and copy it to /tmp/ethereumjs-util.js):
|
||||
|
||||
npm install
|
||||
npm run build
|
||||
15
libs/nanocurrency-web/nano-util.js
Executable file
15
libs/nanocurrency-web/nano-util.js
Executable file
@@ -0,0 +1,15 @@
|
||||
const NanoBase = require('nanocurrency-web');
|
||||
|
||||
window.nanoUtil = {
|
||||
getKeypair: function (index, seed) {
|
||||
const accounts = NanoBase.wallet.accounts(seed, index, index)
|
||||
return {privKey: accounts[0].privateKey, pubKey: accounts[0].publicKey, address: accounts[0].address};
|
||||
},
|
||||
dummyNetwork: {
|
||||
bip32: {public: 0, private: 0},
|
||||
messagePrefix: '',
|
||||
pubKeyHash: 0,
|
||||
scriptHash: 0,
|
||||
wif: 0,
|
||||
},
|
||||
}
|
||||
1614
libs/nanocurrency-web/package-lock.json
generated
Executable file
1614
libs/nanocurrency-web/package-lock.json
generated
Executable file
File diff suppressed because it is too large
Load Diff
14
libs/nanocurrency-web/package.json
Executable file
14
libs/nanocurrency-web/package.json
Executable file
@@ -0,0 +1,14 @@
|
||||
{
|
||||
"name": "nano-util",
|
||||
"version": "0.0.1",
|
||||
"scripts": {
|
||||
"build": "browserify nano-util.js > /tmp/nano-util.js"
|
||||
},
|
||||
"dependencies": {
|
||||
"nanocurrency-web": "^1.2.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"browserify": "^16.2.3",
|
||||
"uglify-es": "^3.3.9"
|
||||
}
|
||||
}
|
||||
4
libs/nanocurrency-web/readme.md
Executable file
4
libs/nanocurrency-web/readme.md
Executable file
@@ -0,0 +1,4 @@
|
||||
Build (will create a bundle and copy it to /tmp/nano-util.js):
|
||||
|
||||
npm install
|
||||
npm run build
|
||||
1389
libs/stellar-util/package-lock.json
generated
Normal file
1389
libs/stellar-util/package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
15
libs/stellar-util/package.json
Normal file
15
libs/stellar-util/package.json
Normal file
@@ -0,0 +1,15 @@
|
||||
{
|
||||
"name": "stellar-util",
|
||||
"version": "0.0.1",
|
||||
"scripts": {
|
||||
"build": "browserify stellar-util.js > /tmp/stellar-util.js"
|
||||
},
|
||||
"dependencies": {
|
||||
"ed25519-hd-key": "^1.0.0",
|
||||
"stellar-base": "^0.10.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"browserify": "^16.2.3",
|
||||
"uglify-es": "^3.3.9"
|
||||
}
|
||||
}
|
||||
4
libs/stellar-util/readme.md
Normal file
4
libs/stellar-util/readme.md
Normal file
@@ -0,0 +1,4 @@
|
||||
Build (will create a bundle and copy it to /tmp/stellar-util.js):
|
||||
|
||||
npm install
|
||||
npm run build
|
||||
16
libs/stellar-util/stellar-util.js
Normal file
16
libs/stellar-util/stellar-util.js
Normal file
@@ -0,0 +1,16 @@
|
||||
const StellarBase = require('stellar-base');
|
||||
const edHd = require('ed25519-hd-key');
|
||||
|
||||
window.stellarUtil = {
|
||||
getKeypair: function (path, seed) {
|
||||
const result = edHd.derivePath(path, seed);
|
||||
return StellarBase.Keypair.fromRawEd25519Seed(result.key);
|
||||
},
|
||||
dummyNetwork: {
|
||||
bip32: {public: 0, private: 0},
|
||||
messagePrefix: '',
|
||||
pubKeyHash: 0,
|
||||
scriptHash: 0,
|
||||
wif: 0,
|
||||
},
|
||||
}
|
||||
30
readme.md
30
readme.md
@@ -4,11 +4,12 @@ A tool for converting BIP39 mnemonic phrases to addresses and private keys.
|
||||
|
||||
## Online Version
|
||||
|
||||
https://iancoleman.github.io/bip39/
|
||||
https://iancoleman.io/bip39/
|
||||
|
||||
## Standalone offline version
|
||||
|
||||
Download `bip39-standalone.html`
|
||||
Download `bip39-standalone.html` from
|
||||
[the releases](https://github.com/iancoleman/bip39/releases).
|
||||
|
||||
Open the file in a browser by double clicking it.
|
||||
|
||||
@@ -55,16 +56,35 @@ at 1PC9aZC4hNX2rmmrt7uHTfYAS3hRbph4UN
|
||||
Please do not make modifications to `bip39-standalone.html`, since they will
|
||||
be overwritten by `compile.py`.
|
||||
|
||||
Make changes in `src/*` and apply them using the command `python compile.py`
|
||||
Make changes in `src/*`.
|
||||
|
||||
Changes are applied during release using the command `python compile.py`, so
|
||||
please do not commit changes to `bip39-standalone.html`
|
||||
|
||||
# Tests
|
||||
|
||||
Tests depend on [phantomjs](http://phantomjs.org/).
|
||||
Tests depend on
|
||||
|
||||
* nodejs
|
||||
* selenium webdriver - cd /path/to/bip39/tests; npm install
|
||||
* selenium driver for firefox ([geckodriver](https://github.com/mozilla/geckodriver/releases)) and / or chrome ([chromedriver](https://sites.google.com/a/chromium.org/chromedriver/downloads))
|
||||
* jasmine - npm install --global jasmine
|
||||
|
||||
Before running tests, the site must be served at http://localhost:8000.
|
||||
|
||||
```
|
||||
$ cd /path/to/bip39/src
|
||||
$ python -m http.server
|
||||
|
||||
or for python2
|
||||
$ python -m SimpleHTTPServer
|
||||
```
|
||||
|
||||
Run tests from the command-line
|
||||
|
||||
```
|
||||
$ phantomjs tests.js
|
||||
$ cd /path/to/bip39/tests
|
||||
$ jasmine spec/tests.js
|
||||
```
|
||||
|
||||
# License
|
||||
|
||||
@@ -7,13 +7,17 @@ created with the following steps:
|
||||
1. Run `python compile.py`
|
||||
1. Commit these changes with message `Release vX.Y.Z`
|
||||
1. Tag the commit `git tag X.Y.Z`
|
||||
1. Push the changes `git push`
|
||||
1. Push the new tag `git push --tags`
|
||||
1. Get the hash of the file `sha256sum bip39-standalone.html`
|
||||
1. Create the text for the release notes (see prior releases)
|
||||
1. Sign the release notes `gpg --clearsign /tmp/releasenotes.txt`
|
||||
1. Sign the release notes `gpg --clearsign /tmp/signature.txt`
|
||||
1. Push the changes `git push`
|
||||
1. Push the new tag `git push --tags`
|
||||
1. Create a release on github from the tagged commit
|
||||
1. include the signed release notes as text for the release
|
||||
1. include the changelog for this release as text for the release
|
||||
1. attach signature.txt.asc
|
||||
1. attach the bip39-standalone.html file
|
||||
1. Add a new post to twitter from @bip39tool with the version, link and hash
|
||||
1. Download the file from the release and confirm it hashes to the expected value `sha256sum bip39-standalone.html`
|
||||
1. Download the signature from the release and verify it. `gpg --verify signature.txt.asc`
|
||||
1. Publish to any hosted locations (eg iancoleman.github.io/bip39)
|
||||
1. Add a new post to twitter from @bip39tool with the version, link and hash
|
||||
|
||||
111
src/css/app.css
Normal file
111
src/css/app.css
Normal file
@@ -0,0 +1,111 @@
|
||||
body {
|
||||
padding-bottom: 32px;
|
||||
}
|
||||
.form-control[readonly] {
|
||||
cursor: text;
|
||||
}
|
||||
.feedback-container {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
width: 100%;
|
||||
text-align: center;
|
||||
z-index: 4;
|
||||
}
|
||||
.feedback {
|
||||
display: table;
|
||||
padding: 0.5em 1em;
|
||||
background-color: orange;
|
||||
margin: 0 auto;
|
||||
font-size: 2em;
|
||||
color: #444;
|
||||
border: 2px solid #555;
|
||||
border-top: 0;
|
||||
border-bottom-left-radius: 20px 20px;
|
||||
border-bottom-right-radius: 20px 20px;
|
||||
}
|
||||
.no-border {
|
||||
border: 0;
|
||||
box-shadow: inset 0 1px 1px rgba(0,0,0,.0);
|
||||
-webkit-box-shadow: inset 0 1px 1px rgba(0,0,0,.0);
|
||||
}
|
||||
.phrase {
|
||||
word-break: keep-all;
|
||||
}
|
||||
.generate-container .strength {
|
||||
/* override mobile width from bootstrap */
|
||||
width: auto!important;
|
||||
display: inline-block;
|
||||
}
|
||||
.languages a {
|
||||
padding-left: 10px;
|
||||
}
|
||||
.languages a:nth-of-type(1) {
|
||||
margin-left: -12px;
|
||||
padding-left: 0;
|
||||
}
|
||||
.monospace {
|
||||
font-family: monospace;
|
||||
}
|
||||
.entropy-container .filtered,
|
||||
.entropy-container .binary {
|
||||
word-wrap: break-word;
|
||||
}
|
||||
.entropy-container li {
|
||||
padding-bottom: 5px;
|
||||
}
|
||||
.card-suit {
|
||||
font-size: 19px;
|
||||
line-height: 0;
|
||||
}
|
||||
.card-suit.club {
|
||||
color: #009F00;
|
||||
}
|
||||
.card-suit.diamond {
|
||||
color: #3D5DC4;
|
||||
}
|
||||
.card-suit.heart {
|
||||
color: #F00;
|
||||
}
|
||||
.card-suit.spade {
|
||||
color: #000;
|
||||
}
|
||||
.qr-container {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
right: 0;
|
||||
text-align: center;
|
||||
background-color: #FFF;
|
||||
border: 1px solid #CCC;
|
||||
}
|
||||
.qr-image {
|
||||
margin: 5px;
|
||||
}
|
||||
.qr-hint,
|
||||
.qr-warning {
|
||||
padding: 2px;
|
||||
max-width: 320px;
|
||||
}
|
||||
.more-info {
|
||||
cursor: help;
|
||||
border-bottom: 1px dashed #000;
|
||||
text-decoration: none;
|
||||
}
|
||||
.version {
|
||||
position: absolute;
|
||||
top: 5px;
|
||||
right: 5px;
|
||||
}
|
||||
.csv {
|
||||
margin-top: 20px;
|
||||
margin-bottom: 20px;
|
||||
white-space: pre;
|
||||
overflow-wrap: normal;
|
||||
overflow-x: scroll;
|
||||
font-family: monospace;
|
||||
}
|
||||
.visual-privacy .private-data {
|
||||
display: none;
|
||||
}
|
||||
.text-weight-normal {
|
||||
font-weight: normal !important;
|
||||
}
|
||||
6834
src/css/bootstrap.css
vendored
Normal file
6834
src/css/bootstrap.css
vendored
Normal file
File diff suppressed because it is too large
Load Diff
1
src/css/bootstrap.css.map
Normal file
1
src/css/bootstrap.css.map
Normal file
File diff suppressed because one or more lines are too long
5
src/css/bootstrap.min.css
vendored
5
src/css/bootstrap.min.css
vendored
File diff suppressed because one or more lines are too long
973
src/index.html
973
src/index.html
File diff suppressed because it is too large
Load Diff
2010
src/js/basex.js
2010
src/js/basex.js
File diff suppressed because it is too large
Load Diff
1620
src/js/biginteger.js
1620
src/js/biginteger.js
File diff suppressed because it is too large
Load Diff
1
src/js/bip39-libs.js
Executable file
1
src/js/bip39-libs.js
Executable file
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
2580
src/js/bootstrap.js
vendored
Normal file
2580
src/js/bootstrap.js
vendored
Normal file
File diff suppressed because it is too large
Load Diff
6
src/js/bootstrap.min.js
vendored
6
src/js/bootstrap.min.js
vendored
File diff suppressed because one or more lines are too long
9
src/js/casinocoin-util.js
Normal file
9
src/js/casinocoin-util.js
Normal file
@@ -0,0 +1,9 @@
|
||||
function convertCasinoCoinAdrr(address) {
|
||||
return libs.basex('cpshnaf39wBUDNEGHJKLM4PQRST7VWXYZ2brdeCg65jkm8oFqi1tuvAxyz').encode(
|
||||
libs.basex('123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz').decode(address)
|
||||
)
|
||||
}
|
||||
|
||||
function convertCasinoCoinPriv(priv) {
|
||||
return libs.basex('123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz').decode(priv).toString("hex").slice(2,66)
|
||||
}
|
||||
13
src/js/cosmos-util.js
Normal file
13
src/js/cosmos-util.js
Normal file
@@ -0,0 +1,13 @@
|
||||
function CosmosBufferToPublic(pubBuf, hrp = "cosmos") {
|
||||
const Buffer = libs.buffer.Buffer;
|
||||
const AminoSecp256k1PubkeyPrefix = Buffer.from("EB5AE987", "hex");
|
||||
const AminoSecp256k1PubkeyLength = Buffer.from("21", "hex");
|
||||
pubBuf = Buffer.concat([AminoSecp256k1PubkeyPrefix, AminoSecp256k1PubkeyLength, pubBuf]);
|
||||
return libs.bech32.encode(`${hrp}pub`, libs.bech32.toWords(pubBuf));
|
||||
}
|
||||
|
||||
function CosmosBufferToAddress(pubBuf, hrp = "cosmos") {
|
||||
const sha256_ed = libs.createHash("sha256").update(pubBuf).digest();
|
||||
const ripemd160_ed = libs.createHash("rmd160").update(sha256_ed).digest();
|
||||
return libs.bech32.encode(hrp, libs.bech32.toWords(ripemd160_ed));
|
||||
}
|
||||
@@ -16,7 +16,136 @@
|
||||
|
||||
window.Entropy = new (function() {
|
||||
|
||||
var TWO = new BigInteger(2);
|
||||
let eventBits = {
|
||||
|
||||
"binary": {
|
||||
"0": "0",
|
||||
"1": "1",
|
||||
},
|
||||
|
||||
// log2(6) = 2.58496 bits per roll, with bias
|
||||
// 4 rolls give 2 bits each
|
||||
// 2 rolls give 1 bit each
|
||||
// Average (4*2 + 2*1) / 6 = 1.66 bits per roll without bias
|
||||
"base 6": {
|
||||
"0": "00",
|
||||
"1": "01",
|
||||
"2": "10",
|
||||
"3": "11",
|
||||
"4": "0",
|
||||
"5": "1",
|
||||
},
|
||||
|
||||
// log2(6) = 2.58496 bits per roll, with bias
|
||||
// 4 rolls give 2 bits each
|
||||
// 2 rolls give 1 bit each
|
||||
// Average (4*2 + 2*1) / 6 = 1.66 bits per roll without bias
|
||||
"base 6 (dice)": {
|
||||
"0": "00", // equivalent to 0 in base 6
|
||||
"1": "01",
|
||||
"2": "10",
|
||||
"3": "11",
|
||||
"4": "0",
|
||||
"5": "1",
|
||||
},
|
||||
|
||||
// log2(10) = 3.321928 bits per digit, with bias
|
||||
// 8 digits give 3 bits each
|
||||
// 2 digits give 1 bit each
|
||||
// Average (8*3 + 2*1) / 10 = 2.6 bits per digit without bias
|
||||
"base 10": {
|
||||
"0": "000",
|
||||
"1": "001",
|
||||
"2": "010",
|
||||
"3": "011",
|
||||
"4": "100",
|
||||
"5": "101",
|
||||
"6": "110",
|
||||
"7": "111",
|
||||
"8": "0",
|
||||
"9": "1",
|
||||
},
|
||||
|
||||
"hexadecimal": {
|
||||
"0": "0000",
|
||||
"1": "0001",
|
||||
"2": "0010",
|
||||
"3": "0011",
|
||||
"4": "0100",
|
||||
"5": "0101",
|
||||
"6": "0110",
|
||||
"7": "0111",
|
||||
"8": "1000",
|
||||
"9": "1001",
|
||||
"a": "1010",
|
||||
"b": "1011",
|
||||
"c": "1100",
|
||||
"d": "1101",
|
||||
"e": "1110",
|
||||
"f": "1111",
|
||||
},
|
||||
|
||||
// log2(52) = 5.7004 bits per card, with bias
|
||||
// 32 cards give 5 bits each
|
||||
// 16 cards give 4 bits each
|
||||
// 4 cards give 2 bits each
|
||||
// Average (32*5 + 16*4 + 4*2) / 52 = 4.46 bits per card without bias
|
||||
"card": {
|
||||
"ac": "00000",
|
||||
"2c": "00001",
|
||||
"3c": "00010",
|
||||
"4c": "00011",
|
||||
"5c": "00100",
|
||||
"6c": "00101",
|
||||
"7c": "00110",
|
||||
"8c": "00111",
|
||||
"9c": "01000",
|
||||
"tc": "01001",
|
||||
"jc": "01010",
|
||||
"qc": "01011",
|
||||
"kc": "01100",
|
||||
"ad": "01101",
|
||||
"2d": "01110",
|
||||
"3d": "01111",
|
||||
"4d": "10000",
|
||||
"5d": "10001",
|
||||
"6d": "10010",
|
||||
"7d": "10011",
|
||||
"8d": "10100",
|
||||
"9d": "10101",
|
||||
"td": "10110",
|
||||
"jd": "10111",
|
||||
"qd": "11000",
|
||||
"kd": "11001",
|
||||
"ah": "11010",
|
||||
"2h": "11011",
|
||||
"3h": "11100",
|
||||
"4h": "11101",
|
||||
"5h": "11110",
|
||||
"6h": "11111",
|
||||
"7h": "0000",
|
||||
"8h": "0001",
|
||||
"9h": "0010",
|
||||
"th": "0011",
|
||||
"jh": "0100",
|
||||
"qh": "0101",
|
||||
"kh": "0110",
|
||||
"as": "0111",
|
||||
"2s": "1000",
|
||||
"3s": "1001",
|
||||
"4s": "1010",
|
||||
"5s": "1011",
|
||||
"6s": "1100",
|
||||
"7s": "1101",
|
||||
"8s": "1110",
|
||||
"9s": "1111",
|
||||
"ts": "00",
|
||||
"js": "01",
|
||||
"qs": "10",
|
||||
"ks": "11",
|
||||
},
|
||||
|
||||
}
|
||||
|
||||
// matchers returns an array of the matched events for each type of entropy.
|
||||
// eg
|
||||
@@ -51,48 +180,28 @@ window.Entropy = new (function() {
|
||||
}
|
||||
}
|
||||
|
||||
// Convert array of cards from ["ac", "4d", "ks"]
|
||||
// to numbers between 0 and 51 [0, 16, 51]
|
||||
function convertCardsToInts(cards) {
|
||||
var ints = [];
|
||||
var values = "a23456789tjqk";
|
||||
var suits = "cdhs";
|
||||
for (var i=0; i<cards.length; i++) {
|
||||
var card = cards[i].toLowerCase();
|
||||
var value = card[0];
|
||||
var suit = card[1];
|
||||
var asInt = 13 * suits.indexOf(suit) + values.indexOf(value);
|
||||
ints.push(asInt);
|
||||
}
|
||||
return ints;
|
||||
}
|
||||
|
||||
this.fromString = function(rawEntropyStr) {
|
||||
this.fromString = function(rawEntropyStr, baseStr) {
|
||||
// Find type of entropy being used (binary, hex, dice etc)
|
||||
var base = getBase(rawEntropyStr);
|
||||
var base = getBase(rawEntropyStr, baseStr);
|
||||
// Convert dice to base6 entropy (ie 1-6 to 0-5)
|
||||
// This is done by changing all 6s to 0s
|
||||
if (base.str == "dice") {
|
||||
var newParts = [];
|
||||
var newInts = [];
|
||||
for (var i=0; i<base.parts.length; i++) {
|
||||
var c = base.parts[i];
|
||||
var newEvents = [];
|
||||
for (var i=0; i<base.events.length; i++) {
|
||||
var c = base.events[i];
|
||||
if ("12345".indexOf(c) > -1) {
|
||||
newParts[i] = base.parts[i];
|
||||
newInts[i] = base.ints[i];
|
||||
newEvents[i] = base.events[i];
|
||||
}
|
||||
else {
|
||||
newParts[i] = "0";
|
||||
newInts[i] = 0;
|
||||
newEvents[i] = "0";
|
||||
}
|
||||
}
|
||||
base.str = "base 6 (dice)";
|
||||
base.ints = newInts;
|
||||
base.parts = newParts;
|
||||
base.events = newEvents;
|
||||
base.matcher = matchers.base6;
|
||||
}
|
||||
// Detect empty entropy
|
||||
if (base.parts.length == 0) {
|
||||
if (base.events.length == 0) {
|
||||
return {
|
||||
binaryStr: "",
|
||||
cleanStr: "",
|
||||
@@ -100,44 +209,23 @@ window.Entropy = new (function() {
|
||||
base: base,
|
||||
};
|
||||
}
|
||||
// Convert base.ints to BigInteger.
|
||||
// Due to using unusual bases, eg cards of base52, this is not as simple as
|
||||
// using BigInteger.parse()
|
||||
var entropyInt = BigInteger.ZERO;
|
||||
for (var i=base.ints.length-1; i>=0; i--) {
|
||||
var thisInt = BigInteger.parse(base.ints[i]);
|
||||
var power = (base.ints.length - 1) - i;
|
||||
var additionalEntropy = BigInteger.parse(base.asInt).pow(power).multiply(thisInt);
|
||||
entropyInt = entropyInt.add(additionalEntropy);
|
||||
}
|
||||
// Convert entropy to binary
|
||||
var entropyBin = entropyInt.toString(2);
|
||||
// If the first integer is small, it must be padded with zeros.
|
||||
// Otherwise the chance of the first bit being 1 is 100%, which is
|
||||
// obviously incorrect.
|
||||
// This is not perfect for non-2^n bases.
|
||||
var expectedBits = Math.floor(base.parts.length * Math.log2(base.asInt));
|
||||
while (entropyBin.length < expectedBits) {
|
||||
entropyBin = "0" + entropyBin;
|
||||
}
|
||||
// Calculate the number of bits per event
|
||||
var bitsPerEvent = Math.log2(base.asInt);
|
||||
// Cards binary must be handled differently, since they're not replaced
|
||||
if (base.asInt == 52) {
|
||||
var cardEntropy = processCardEntropy(base.parts);
|
||||
entropyBin = cardEntropy.binaryStr;
|
||||
bitsPerEvent = cardEntropy.bitsPerEvent;
|
||||
}
|
||||
// Convert entropy events to binary
|
||||
var entropyBin = base.events.map(function(e) {
|
||||
return eventBits[base.str][e.toLowerCase()];
|
||||
}).join("");
|
||||
// Get average bits per event
|
||||
// which may be adjusted for bias if log2(base) is fractional
|
||||
var bitsPerEvent = base.bitsPerEvent;
|
||||
// Supply a 'filtered' entropy string for display purposes
|
||||
var entropyClean = base.parts.join("");
|
||||
var entropyHtml = base.parts.join("");
|
||||
var entropyClean = base.events.join("");
|
||||
var entropyHtml = base.events.join("");
|
||||
if (base.asInt == 52) {
|
||||
entropyClean = base.parts.join(" ").toUpperCase();
|
||||
entropyClean = base.events.join(" ").toUpperCase();
|
||||
entropyClean = entropyClean.replace(/C/g, "\u2663");
|
||||
entropyClean = entropyClean.replace(/D/g, "\u2666");
|
||||
entropyClean = entropyClean.replace(/H/g, "\u2665");
|
||||
entropyClean = entropyClean.replace(/S/g, "\u2660");
|
||||
entropyHtml = base.parts.join(" ").toUpperCase();
|
||||
entropyHtml = base.events.join(" ").toUpperCase();
|
||||
entropyHtml = entropyHtml.replace(/C/g, "<span class='card-suit club'>\u2663</span>");
|
||||
entropyHtml = entropyHtml.replace(/D/g, "<span class='card-suit diamond'>\u2666</span>");
|
||||
entropyHtml = entropyHtml.replace(/H/g, "<span class='card-suit heart'>\u2665</span>");
|
||||
@@ -154,192 +242,80 @@ window.Entropy = new (function() {
|
||||
return e;
|
||||
}
|
||||
|
||||
function getSortedDeck() {
|
||||
var s = [];
|
||||
var suits = "CDHS";
|
||||
var values = "A23456789TJQK";
|
||||
for (var i=0; i<suits.length; i++) {
|
||||
for (var j=0; j<values.length; j++) {
|
||||
s.push(values[j]+suits[i]);
|
||||
}
|
||||
}
|
||||
return s;
|
||||
}
|
||||
|
||||
function getBase(str) {
|
||||
function getBase(str, baseStr) {
|
||||
// Need to get the lowest base for the supplied entropy.
|
||||
// This prevents interpreting, say, dice rolls as hexadecimal.
|
||||
var binaryMatches = matchers.binary(str);
|
||||
var hexMatches = matchers.hex(str);
|
||||
var autodetect = baseStr === undefined;
|
||||
// Find the lowest base that can be used, whilst ignoring any irrelevant chars
|
||||
if (binaryMatches.length == hexMatches.length && hexMatches.length > 0) {
|
||||
if ((binaryMatches.length == hexMatches.length && hexMatches.length > 0 && autodetect) || baseStr === "binary") {
|
||||
var ints = binaryMatches.map(function(i) { return parseInt(i, 2) });
|
||||
return {
|
||||
ints: ints,
|
||||
parts: binaryMatches,
|
||||
events: binaryMatches,
|
||||
matcher: matchers.binary,
|
||||
asInt: 2,
|
||||
bitsPerEvent: 1,
|
||||
str: "binary",
|
||||
}
|
||||
}
|
||||
var cardMatches = matchers.card(str);
|
||||
if (cardMatches.length >= hexMatches.length / 2) {
|
||||
var ints = convertCardsToInts(cardMatches);
|
||||
if ((cardMatches.length >= hexMatches.length / 2 && autodetect) || baseStr === "card") {
|
||||
return {
|
||||
ints: ints,
|
||||
parts: cardMatches,
|
||||
events: cardMatches,
|
||||
matcher: matchers.card,
|
||||
asInt: 52,
|
||||
bitsPerEvent: (32*5 + 16*4 + 4*2) / 52, // see cardBits
|
||||
str: "card",
|
||||
}
|
||||
}
|
||||
var diceMatches = matchers.dice(str);
|
||||
if (diceMatches.length == hexMatches.length && hexMatches.length > 0) {
|
||||
if ((diceMatches.length == hexMatches.length && hexMatches.length > 0 && autodetect) || baseStr === "dice") {
|
||||
var ints = diceMatches.map(function(i) { return parseInt(i) });
|
||||
return {
|
||||
ints: ints,
|
||||
parts: diceMatches,
|
||||
events: diceMatches,
|
||||
matcher: matchers.dice,
|
||||
asInt: 6,
|
||||
bitsPerEvent: (4*2 + 2*1) / 6, // see diceBits
|
||||
str: "dice",
|
||||
}
|
||||
}
|
||||
var base6Matches = matchers.base6(str);
|
||||
if (base6Matches.length == hexMatches.length && hexMatches.length > 0) {
|
||||
if ((base6Matches.length == hexMatches.length && hexMatches.length > 0 && autodetect) || baseStr === "base 6") {
|
||||
var ints = base6Matches.map(function(i) { return parseInt(i) });
|
||||
return {
|
||||
ints: ints,
|
||||
parts: base6Matches,
|
||||
events: base6Matches,
|
||||
matcher: matchers.base6,
|
||||
asInt: 6,
|
||||
bitsPerEvent: (4*2 + 2*1) / 6, // see diceBits
|
||||
str: "base 6",
|
||||
}
|
||||
}
|
||||
var base10Matches = matchers.base10(str);
|
||||
if (base10Matches.length == hexMatches.length && hexMatches.length > 0) {
|
||||
if ((base10Matches.length == hexMatches.length && hexMatches.length > 0 && autodetect) || baseStr === "base 10") {
|
||||
var ints = base10Matches.map(function(i) { return parseInt(i) });
|
||||
return {
|
||||
ints: ints,
|
||||
parts: base10Matches,
|
||||
events: base10Matches,
|
||||
matcher: matchers.base10,
|
||||
asInt: 10,
|
||||
bitsPerEvent: (8*3 + 2*1) / 10, // see b10Bits
|
||||
str: "base 10",
|
||||
}
|
||||
}
|
||||
var ints = hexMatches.map(function(i) { return parseInt(i, 16) });
|
||||
return {
|
||||
ints: ints,
|
||||
parts: hexMatches,
|
||||
events: hexMatches,
|
||||
matcher: matchers.hex,
|
||||
asInt: 16,
|
||||
bitsPerEvent: 4,
|
||||
str: "hexadecimal",
|
||||
}
|
||||
}
|
||||
|
||||
// Assume cards are NOT replaced.
|
||||
// Additional entropy decreases as more cards are used. This means
|
||||
// total possible entropy is measured using n!, not base^n.
|
||||
// eg the second last card can be only one of two, not one of fifty two
|
||||
// so the added entropy for that card is only one bit at most
|
||||
function processCardEntropy(cards) {
|
||||
// Track how many instances of each card have been used, and thus
|
||||
// how many decks are in use.
|
||||
var cardCounts = {};
|
||||
var numberOfDecks = 0;
|
||||
// Work out number of decks by max(duplicates)
|
||||
for (var i=0; i<cards.length; i++) {
|
||||
// Get the card that was drawn
|
||||
var cardLower = cards[i];
|
||||
var card = cardLower.toUpperCase();
|
||||
// Initialize the count for this card if needed
|
||||
if (!(card in cardCounts)) {
|
||||
cardCounts[card] = 0;
|
||||
}
|
||||
cardCounts[card] += 1;
|
||||
// See if this is max(duplicates)
|
||||
if (cardCounts[card] > numberOfDecks) {
|
||||
numberOfDecks = cardCounts[card];
|
||||
}
|
||||
}
|
||||
// Work out the total number of bits for this many decks
|
||||
// See http://crypto.stackexchange.com/q/41886
|
||||
var gainedBits = 0;
|
||||
// Equivalent of Math.log2(factorial(52*numberOfDecks))
|
||||
// which becomes infinity for numberOfDecks > 4
|
||||
for (var i=1; i<=52*numberOfDecks; i++) {
|
||||
gainedBits = gainedBits + Math.log2(i);
|
||||
}
|
||||
var lostBits = 52 * Math.log2(factorial(numberOfDecks));
|
||||
var maxBits = gainedBits - lostBits;
|
||||
// Convert the drawn cards to a binary representation.
|
||||
// The exact technique for doing this is unclear.
|
||||
// See
|
||||
// http://crypto.stackexchange.com/a/41896
|
||||
// "I even doubt that this is well defined (only the average entropy
|
||||
// is, I believe)."
|
||||
// See
|
||||
// https://github.com/iancoleman/bip39/issues/33#issuecomment-263021856
|
||||
// "The binary representation can be the first log(permutations,2) bits
|
||||
// of the sha-2 hash of the normalized deck string."
|
||||
//
|
||||
// In this specific implementation, the first N bits of the hash of the
|
||||
// normalized cards string is being used. Uppercase, no spaces; eg
|
||||
// sha256("AH8DQSTC2H")
|
||||
var totalCards = numberOfDecks * 52;
|
||||
var percentUsed = cards.length / totalCards;
|
||||
// Calculate the average number of bits of entropy for the number of
|
||||
// cards drawn.
|
||||
var numberOfBits = Math.floor(maxBits * percentUsed);
|
||||
// Create a normalized string of the selected cards
|
||||
var normalizedCards = cards.join("").toUpperCase();
|
||||
// Convert to binary using the SHA256 hash of the normalized cards.
|
||||
// If the number of bits is more than 256, multiple hashes
|
||||
// are used until the required number of bits is reached.
|
||||
var entropyBin = "";
|
||||
var iterations = 0;
|
||||
while (entropyBin.length < numberOfBits) {
|
||||
var hashedCards = sjcl.hash.sha256.hash(normalizedCards + ":" + iterations);
|
||||
var hashHex = sjcl.codec.hex.fromBits(hashedCards);
|
||||
for (var i=0; i<hashHex.length; i++) {
|
||||
var decimal = parseInt(hashHex[i], 16);
|
||||
var binary = decimal.toString(2);
|
||||
while (binary.length < 4) {
|
||||
binary = "0" + binary;
|
||||
}
|
||||
entropyBin = entropyBin + binary;
|
||||
}
|
||||
iterations = iterations + 1;
|
||||
}
|
||||
// Truncate to the appropriate number of bits.
|
||||
entropyBin = entropyBin.substring(0, numberOfBits);
|
||||
// Get the number of bits per event
|
||||
bitsPerEvent = maxBits / totalCards;
|
||||
return {
|
||||
binaryStr: entropyBin,
|
||||
bitsPerEvent: bitsPerEvent,
|
||||
}
|
||||
}
|
||||
|
||||
// Polyfill for Math.log2
|
||||
// See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/log2#Polyfill
|
||||
Math.log2 = Math.log2 || function(x) {
|
||||
// The polyfill isn't good enough because of the poor accuracy of
|
||||
// Math.LOG2E
|
||||
// log2(8) gave 2.9999999999999996 which when floored causes issues.
|
||||
// So instead use the BigInteger library to get it right.
|
||||
return BigInteger.log(x) / BigInteger.log(2);
|
||||
};
|
||||
|
||||
// Depends on BigInteger
|
||||
function factorial(n) {
|
||||
if (n == 0) {
|
||||
return 1;
|
||||
}
|
||||
f = BigInteger.ONE;
|
||||
for (var i=1; i<=n; i++) {
|
||||
f = f.multiply(new BigInteger(i));
|
||||
}
|
||||
return f;
|
||||
}
|
||||
|
||||
})();
|
||||
|
||||
17
src/js/eos-util.js
Normal file
17
src/js/eos-util.js
Normal file
@@ -0,0 +1,17 @@
|
||||
function EOSbufferToPublic(pubBuf) {
|
||||
const Buffer = libs.buffer.Buffer;
|
||||
const EOS_PUBLIC_PREFIX = "EOS";
|
||||
let checksum = libs.createHash("rmd160").update(pubBuf).digest("hex").slice(0, 8);
|
||||
pubBuf = Buffer.concat([pubBuf, Buffer.from(checksum, "hex")]);
|
||||
return EOS_PUBLIC_PREFIX.concat(libs.bs58.encode(pubBuf));
|
||||
}
|
||||
|
||||
function EOSbufferToPrivate(privBuf) {
|
||||
const Buffer = libs.buffer.Buffer;
|
||||
const EOS_PRIVATE_PREFIX = "80";
|
||||
privBuf = Buffer.concat([Buffer.from(EOS_PRIVATE_PREFIX, "hex"), privBuf]);
|
||||
let tmp = libs.createHash("sha256").update(privBuf).digest();
|
||||
let checksum = libs.createHash("sha256").update(tmp).digest("hex").slice(0, 8);
|
||||
privBuf = Buffer.concat([privBuf, Buffer.from(checksum, "hex")]);
|
||||
return libs.bs58.encode(privBuf);
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
19
src/js/fio-util.js
Normal file
19
src/js/fio-util.js
Normal file
@@ -0,0 +1,19 @@
|
||||
function FIObufferToPublic(pubBuf) {
|
||||
const Buffer = libs.buffer.Buffer;
|
||||
const FIO_PUBLIC_PREFIX = "FIO";
|
||||
|
||||
let checksum = libs.createHash("rmd160").update(pubBuf).digest("hex").slice(0, 8);
|
||||
pubBuf = Buffer.concat([pubBuf, Buffer.from(checksum, "hex")]);
|
||||
return FIO_PUBLIC_PREFIX.concat(libs.bs58.encode(pubBuf));
|
||||
}
|
||||
|
||||
function FIObufferToPrivate(privBuf) {
|
||||
const Buffer = libs.buffer.Buffer;
|
||||
const FIO_PRIVATE_PREFIX = "80";
|
||||
|
||||
privBuf = Buffer.concat([Buffer.from(FIO_PRIVATE_PREFIX, "hex"), privBuf]);
|
||||
let tmp = libs.createHash("sha256").update(privBuf).digest();
|
||||
let checksum = libs.createHash("sha256").update(tmp).digest("hex").slice(0, 8);
|
||||
privBuf = Buffer.concat([privBuf, Buffer.from(checksum, "hex")]);
|
||||
return libs.bs58.encode(privBuf);
|
||||
}
|
||||
2760
src/js/index.js
2760
src/js/index.js
File diff suppressed because it is too large
Load Diff
10
src/js/jingtum-util.js
Normal file
10
src/js/jingtum-util.js
Normal file
@@ -0,0 +1,10 @@
|
||||
function convertJingtumAdrr(address) {
|
||||
return libs.basex('jpshnaf39wBUDNEGHJKLM4PQRST7VWXYZ2bcdeCg65rkm8oFqi1tuvAxyz').encode(
|
||||
libs.basex('123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz').decode(address)
|
||||
)
|
||||
}
|
||||
|
||||
function convertJingtumPriv(priv) {
|
||||
return libs.basex('123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz').decode(priv).toString("hex").slice(2,66)
|
||||
}
|
||||
|
||||
10253
src/js/jquery-3.2.1.js
vendored
Normal file
10253
src/js/jquery-3.2.1.js
vendored
Normal file
File diff suppressed because it is too large
Load Diff
4
src/js/jquery.min.js
vendored
4
src/js/jquery.min.js
vendored
File diff suppressed because one or more lines are too long
28
src/js/jquery.qrcode.min.js
vendored
28
src/js/jquery.qrcode.min.js
vendored
@@ -1,28 +0,0 @@
|
||||
(function(r){r.fn.qrcode=function(h){var s;function u(a){this.mode=s;this.data=a}function o(a,c){this.typeNumber=a;this.errorCorrectLevel=c;this.modules=null;this.moduleCount=0;this.dataCache=null;this.dataList=[]}function q(a,c){if(void 0==a.length)throw Error(a.length+"/"+c);for(var d=0;d<a.length&&0==a[d];)d++;this.num=Array(a.length-d+c);for(var b=0;b<a.length-d;b++)this.num[b]=a[b+d]}function p(a,c){this.totalCount=a;this.dataCount=c}function t(){this.buffer=[];this.length=0}u.prototype={getLength:function(){return this.data.length},
|
||||
write:function(a){for(var c=0;c<this.data.length;c++)a.put(this.data.charCodeAt(c),8)}};o.prototype={addData:function(a){this.dataList.push(new u(a));this.dataCache=null},isDark:function(a,c){if(0>a||this.moduleCount<=a||0>c||this.moduleCount<=c)throw Error(a+","+c);return this.modules[a][c]},getModuleCount:function(){return this.moduleCount},make:function(){if(1>this.typeNumber){for(var a=1,a=1;40>a;a++){for(var c=p.getRSBlocks(a,this.errorCorrectLevel),d=new t,b=0,e=0;e<c.length;e++)b+=c[e].dataCount;
|
||||
for(e=0;e<this.dataList.length;e++)c=this.dataList[e],d.put(c.mode,4),d.put(c.getLength(),j.getLengthInBits(c.mode,a)),c.write(d);if(d.getLengthInBits()<=8*b)break}this.typeNumber=a}this.makeImpl(!1,this.getBestMaskPattern())},makeImpl:function(a,c){this.moduleCount=4*this.typeNumber+17;this.modules=Array(this.moduleCount);for(var d=0;d<this.moduleCount;d++){this.modules[d]=Array(this.moduleCount);for(var b=0;b<this.moduleCount;b++)this.modules[d][b]=null}this.setupPositionProbePattern(0,0);this.setupPositionProbePattern(this.moduleCount-
|
||||
7,0);this.setupPositionProbePattern(0,this.moduleCount-7);this.setupPositionAdjustPattern();this.setupTimingPattern();this.setupTypeInfo(a,c);7<=this.typeNumber&&this.setupTypeNumber(a);null==this.dataCache&&(this.dataCache=o.createData(this.typeNumber,this.errorCorrectLevel,this.dataList));this.mapData(this.dataCache,c)},setupPositionProbePattern:function(a,c){for(var d=-1;7>=d;d++)if(!(-1>=a+d||this.moduleCount<=a+d))for(var b=-1;7>=b;b++)-1>=c+b||this.moduleCount<=c+b||(this.modules[a+d][c+b]=
|
||||
0<=d&&6>=d&&(0==b||6==b)||0<=b&&6>=b&&(0==d||6==d)||2<=d&&4>=d&&2<=b&&4>=b?!0:!1)},getBestMaskPattern:function(){for(var a=0,c=0,d=0;8>d;d++){this.makeImpl(!0,d);var b=j.getLostPoint(this);if(0==d||a>b)a=b,c=d}return c},createMovieClip:function(a,c,d){a=a.createEmptyMovieClip(c,d);this.make();for(c=0;c<this.modules.length;c++)for(var d=1*c,b=0;b<this.modules[c].length;b++){var e=1*b;this.modules[c][b]&&(a.beginFill(0,100),a.moveTo(e,d),a.lineTo(e+1,d),a.lineTo(e+1,d+1),a.lineTo(e,d+1),a.endFill())}return a},
|
||||
setupTimingPattern:function(){for(var a=8;a<this.moduleCount-8;a++)null==this.modules[a][6]&&(this.modules[a][6]=0==a%2);for(a=8;a<this.moduleCount-8;a++)null==this.modules[6][a]&&(this.modules[6][a]=0==a%2)},setupPositionAdjustPattern:function(){for(var a=j.getPatternPosition(this.typeNumber),c=0;c<a.length;c++)for(var d=0;d<a.length;d++){var b=a[c],e=a[d];if(null==this.modules[b][e])for(var f=-2;2>=f;f++)for(var i=-2;2>=i;i++)this.modules[b+f][e+i]=-2==f||2==f||-2==i||2==i||0==f&&0==i?!0:!1}},setupTypeNumber:function(a){for(var c=
|
||||
j.getBCHTypeNumber(this.typeNumber),d=0;18>d;d++){var b=!a&&1==(c>>d&1);this.modules[Math.floor(d/3)][d%3+this.moduleCount-8-3]=b}for(d=0;18>d;d++)b=!a&&1==(c>>d&1),this.modules[d%3+this.moduleCount-8-3][Math.floor(d/3)]=b},setupTypeInfo:function(a,c){for(var d=j.getBCHTypeInfo(this.errorCorrectLevel<<3|c),b=0;15>b;b++){var e=!a&&1==(d>>b&1);6>b?this.modules[b][8]=e:8>b?this.modules[b+1][8]=e:this.modules[this.moduleCount-15+b][8]=e}for(b=0;15>b;b++)e=!a&&1==(d>>b&1),8>b?this.modules[8][this.moduleCount-
|
||||
b-1]=e:9>b?this.modules[8][15-b-1+1]=e:this.modules[8][15-b-1]=e;this.modules[this.moduleCount-8][8]=!a},mapData:function(a,c){for(var d=-1,b=this.moduleCount-1,e=7,f=0,i=this.moduleCount-1;0<i;i-=2)for(6==i&&i--;;){for(var g=0;2>g;g++)if(null==this.modules[b][i-g]){var n=!1;f<a.length&&(n=1==(a[f]>>>e&1));j.getMask(c,b,i-g)&&(n=!n);this.modules[b][i-g]=n;e--; -1==e&&(f++,e=7)}b+=d;if(0>b||this.moduleCount<=b){b-=d;d=-d;break}}}};o.PAD0=236;o.PAD1=17;o.createData=function(a,c,d){for(var c=p.getRSBlocks(a,
|
||||
c),b=new t,e=0;e<d.length;e++){var f=d[e];b.put(f.mode,4);b.put(f.getLength(),j.getLengthInBits(f.mode,a));f.write(b)}for(e=a=0;e<c.length;e++)a+=c[e].dataCount;if(b.getLengthInBits()>8*a)throw Error("code length overflow. ("+b.getLengthInBits()+">"+8*a+")");for(b.getLengthInBits()+4<=8*a&&b.put(0,4);0!=b.getLengthInBits()%8;)b.putBit(!1);for(;!(b.getLengthInBits()>=8*a);){b.put(o.PAD0,8);if(b.getLengthInBits()>=8*a)break;b.put(o.PAD1,8)}return o.createBytes(b,c)};o.createBytes=function(a,c){for(var d=
|
||||
0,b=0,e=0,f=Array(c.length),i=Array(c.length),g=0;g<c.length;g++){var n=c[g].dataCount,h=c[g].totalCount-n,b=Math.max(b,n),e=Math.max(e,h);f[g]=Array(n);for(var k=0;k<f[g].length;k++)f[g][k]=255&a.buffer[k+d];d+=n;k=j.getErrorCorrectPolynomial(h);n=(new q(f[g],k.getLength()-1)).mod(k);i[g]=Array(k.getLength()-1);for(k=0;k<i[g].length;k++)h=k+n.getLength()-i[g].length,i[g][k]=0<=h?n.get(h):0}for(k=g=0;k<c.length;k++)g+=c[k].totalCount;d=Array(g);for(k=n=0;k<b;k++)for(g=0;g<c.length;g++)k<f[g].length&&
|
||||
(d[n++]=f[g][k]);for(k=0;k<e;k++)for(g=0;g<c.length;g++)k<i[g].length&&(d[n++]=i[g][k]);return d};s=4;for(var j={PATTERN_POSITION_TABLE:[[],[6,18],[6,22],[6,26],[6,30],[6,34],[6,22,38],[6,24,42],[6,26,46],[6,28,50],[6,30,54],[6,32,58],[6,34,62],[6,26,46,66],[6,26,48,70],[6,26,50,74],[6,30,54,78],[6,30,56,82],[6,30,58,86],[6,34,62,90],[6,28,50,72,94],[6,26,50,74,98],[6,30,54,78,102],[6,28,54,80,106],[6,32,58,84,110],[6,30,58,86,114],[6,34,62,90,118],[6,26,50,74,98,122],[6,30,54,78,102,126],[6,26,52,
|
||||
78,104,130],[6,30,56,82,108,134],[6,34,60,86,112,138],[6,30,58,86,114,142],[6,34,62,90,118,146],[6,30,54,78,102,126,150],[6,24,50,76,102,128,154],[6,28,54,80,106,132,158],[6,32,58,84,110,136,162],[6,26,54,82,110,138,166],[6,30,58,86,114,142,170]],G15:1335,G18:7973,G15_MASK:21522,getBCHTypeInfo:function(a){for(var c=a<<10;0<=j.getBCHDigit(c)-j.getBCHDigit(j.G15);)c^=j.G15<<j.getBCHDigit(c)-j.getBCHDigit(j.G15);return(a<<10|c)^j.G15_MASK},getBCHTypeNumber:function(a){for(var c=a<<12;0<=j.getBCHDigit(c)-
|
||||
j.getBCHDigit(j.G18);)c^=j.G18<<j.getBCHDigit(c)-j.getBCHDigit(j.G18);return a<<12|c},getBCHDigit:function(a){for(var c=0;0!=a;)c++,a>>>=1;return c},getPatternPosition:function(a){return j.PATTERN_POSITION_TABLE[a-1]},getMask:function(a,c,d){switch(a){case 0:return 0==(c+d)%2;case 1:return 0==c%2;case 2:return 0==d%3;case 3:return 0==(c+d)%3;case 4:return 0==(Math.floor(c/2)+Math.floor(d/3))%2;case 5:return 0==c*d%2+c*d%3;case 6:return 0==(c*d%2+c*d%3)%2;case 7:return 0==(c*d%3+(c+d)%2)%2;default:throw Error("bad maskPattern:"+
|
||||
a);}},getErrorCorrectPolynomial:function(a){for(var c=new q([1],0),d=0;d<a;d++)c=c.multiply(new q([1,l.gexp(d)],0));return c},getLengthInBits:function(a,c){if(1<=c&&10>c)switch(a){case 1:return 10;case 2:return 9;case s:return 8;case 8:return 8;default:throw Error("mode:"+a);}else if(27>c)switch(a){case 1:return 12;case 2:return 11;case s:return 16;case 8:return 10;default:throw Error("mode:"+a);}else if(41>c)switch(a){case 1:return 14;case 2:return 13;case s:return 16;case 8:return 12;default:throw Error("mode:"+
|
||||
a);}else throw Error("type:"+c);},getLostPoint:function(a){for(var c=a.getModuleCount(),d=0,b=0;b<c;b++)for(var e=0;e<c;e++){for(var f=0,i=a.isDark(b,e),g=-1;1>=g;g++)if(!(0>b+g||c<=b+g))for(var h=-1;1>=h;h++)0>e+h||c<=e+h||0==g&&0==h||i==a.isDark(b+g,e+h)&&f++;5<f&&(d+=3+f-5)}for(b=0;b<c-1;b++)for(e=0;e<c-1;e++)if(f=0,a.isDark(b,e)&&f++,a.isDark(b+1,e)&&f++,a.isDark(b,e+1)&&f++,a.isDark(b+1,e+1)&&f++,0==f||4==f)d+=3;for(b=0;b<c;b++)for(e=0;e<c-6;e++)a.isDark(b,e)&&!a.isDark(b,e+1)&&a.isDark(b,e+
|
||||
2)&&a.isDark(b,e+3)&&a.isDark(b,e+4)&&!a.isDark(b,e+5)&&a.isDark(b,e+6)&&(d+=40);for(e=0;e<c;e++)for(b=0;b<c-6;b++)a.isDark(b,e)&&!a.isDark(b+1,e)&&a.isDark(b+2,e)&&a.isDark(b+3,e)&&a.isDark(b+4,e)&&!a.isDark(b+5,e)&&a.isDark(b+6,e)&&(d+=40);for(e=f=0;e<c;e++)for(b=0;b<c;b++)a.isDark(b,e)&&f++;a=Math.abs(100*f/c/c-50)/5;return d+10*a}},l={glog:function(a){if(1>a)throw Error("glog("+a+")");return l.LOG_TABLE[a]},gexp:function(a){for(;0>a;)a+=255;for(;256<=a;)a-=255;return l.EXP_TABLE[a]},EXP_TABLE:Array(256),
|
||||
LOG_TABLE:Array(256)},m=0;8>m;m++)l.EXP_TABLE[m]=1<<m;for(m=8;256>m;m++)l.EXP_TABLE[m]=l.EXP_TABLE[m-4]^l.EXP_TABLE[m-5]^l.EXP_TABLE[m-6]^l.EXP_TABLE[m-8];for(m=0;255>m;m++)l.LOG_TABLE[l.EXP_TABLE[m]]=m;q.prototype={get:function(a){return this.num[a]},getLength:function(){return this.num.length},multiply:function(a){for(var c=Array(this.getLength()+a.getLength()-1),d=0;d<this.getLength();d++)for(var b=0;b<a.getLength();b++)c[d+b]^=l.gexp(l.glog(this.get(d))+l.glog(a.get(b)));return new q(c,0)},mod:function(a){if(0>
|
||||
this.getLength()-a.getLength())return this;for(var c=l.glog(this.get(0))-l.glog(a.get(0)),d=Array(this.getLength()),b=0;b<this.getLength();b++)d[b]=this.get(b);for(b=0;b<a.getLength();b++)d[b]^=l.gexp(l.glog(a.get(b))+c);return(new q(d,0)).mod(a)}};p.RS_BLOCK_TABLE=[[1,26,19],[1,26,16],[1,26,13],[1,26,9],[1,44,34],[1,44,28],[1,44,22],[1,44,16],[1,70,55],[1,70,44],[2,35,17],[2,35,13],[1,100,80],[2,50,32],[2,50,24],[4,25,9],[1,134,108],[2,67,43],[2,33,15,2,34,16],[2,33,11,2,34,12],[2,86,68],[4,43,27],
|
||||
[4,43,19],[4,43,15],[2,98,78],[4,49,31],[2,32,14,4,33,15],[4,39,13,1,40,14],[2,121,97],[2,60,38,2,61,39],[4,40,18,2,41,19],[4,40,14,2,41,15],[2,146,116],[3,58,36,2,59,37],[4,36,16,4,37,17],[4,36,12,4,37,13],[2,86,68,2,87,69],[4,69,43,1,70,44],[6,43,19,2,44,20],[6,43,15,2,44,16],[4,101,81],[1,80,50,4,81,51],[4,50,22,4,51,23],[3,36,12,8,37,13],[2,116,92,2,117,93],[6,58,36,2,59,37],[4,46,20,6,47,21],[7,42,14,4,43,15],[4,133,107],[8,59,37,1,60,38],[8,44,20,4,45,21],[12,33,11,4,34,12],[3,145,115,1,146,
|
||||
116],[4,64,40,5,65,41],[11,36,16,5,37,17],[11,36,12,5,37,13],[5,109,87,1,110,88],[5,65,41,5,66,42],[5,54,24,7,55,25],[11,36,12],[5,122,98,1,123,99],[7,73,45,3,74,46],[15,43,19,2,44,20],[3,45,15,13,46,16],[1,135,107,5,136,108],[10,74,46,1,75,47],[1,50,22,15,51,23],[2,42,14,17,43,15],[5,150,120,1,151,121],[9,69,43,4,70,44],[17,50,22,1,51,23],[2,42,14,19,43,15],[3,141,113,4,142,114],[3,70,44,11,71,45],[17,47,21,4,48,22],[9,39,13,16,40,14],[3,135,107,5,136,108],[3,67,41,13,68,42],[15,54,24,5,55,25],[15,
|
||||
43,15,10,44,16],[4,144,116,4,145,117],[17,68,42],[17,50,22,6,51,23],[19,46,16,6,47,17],[2,139,111,7,140,112],[17,74,46],[7,54,24,16,55,25],[34,37,13],[4,151,121,5,152,122],[4,75,47,14,76,48],[11,54,24,14,55,25],[16,45,15,14,46,16],[6,147,117,4,148,118],[6,73,45,14,74,46],[11,54,24,16,55,25],[30,46,16,2,47,17],[8,132,106,4,133,107],[8,75,47,13,76,48],[7,54,24,22,55,25],[22,45,15,13,46,16],[10,142,114,2,143,115],[19,74,46,4,75,47],[28,50,22,6,51,23],[33,46,16,4,47,17],[8,152,122,4,153,123],[22,73,45,
|
||||
3,74,46],[8,53,23,26,54,24],[12,45,15,28,46,16],[3,147,117,10,148,118],[3,73,45,23,74,46],[4,54,24,31,55,25],[11,45,15,31,46,16],[7,146,116,7,147,117],[21,73,45,7,74,46],[1,53,23,37,54,24],[19,45,15,26,46,16],[5,145,115,10,146,116],[19,75,47,10,76,48],[15,54,24,25,55,25],[23,45,15,25,46,16],[13,145,115,3,146,116],[2,74,46,29,75,47],[42,54,24,1,55,25],[23,45,15,28,46,16],[17,145,115],[10,74,46,23,75,47],[10,54,24,35,55,25],[19,45,15,35,46,16],[17,145,115,1,146,116],[14,74,46,21,75,47],[29,54,24,19,
|
||||
55,25],[11,45,15,46,46,16],[13,145,115,6,146,116],[14,74,46,23,75,47],[44,54,24,7,55,25],[59,46,16,1,47,17],[12,151,121,7,152,122],[12,75,47,26,76,48],[39,54,24,14,55,25],[22,45,15,41,46,16],[6,151,121,14,152,122],[6,75,47,34,76,48],[46,54,24,10,55,25],[2,45,15,64,46,16],[17,152,122,4,153,123],[29,74,46,14,75,47],[49,54,24,10,55,25],[24,45,15,46,46,16],[4,152,122,18,153,123],[13,74,46,32,75,47],[48,54,24,14,55,25],[42,45,15,32,46,16],[20,147,117,4,148,118],[40,75,47,7,76,48],[43,54,24,22,55,25],[10,
|
||||
45,15,67,46,16],[19,148,118,6,149,119],[18,75,47,31,76,48],[34,54,24,34,55,25],[20,45,15,61,46,16]];p.getRSBlocks=function(a,c){var d=p.getRsBlockTable(a,c);if(void 0==d)throw Error("bad rs block @ typeNumber:"+a+"/errorCorrectLevel:"+c);for(var b=d.length/3,e=[],f=0;f<b;f++)for(var h=d[3*f+0],g=d[3*f+1],j=d[3*f+2],l=0;l<h;l++)e.push(new p(g,j));return e};p.getRsBlockTable=function(a,c){switch(c){case 1:return p.RS_BLOCK_TABLE[4*(a-1)+0];case 0:return p.RS_BLOCK_TABLE[4*(a-1)+1];case 3:return p.RS_BLOCK_TABLE[4*
|
||||
(a-1)+2];case 2:return p.RS_BLOCK_TABLE[4*(a-1)+3]}};t.prototype={get:function(a){return 1==(this.buffer[Math.floor(a/8)]>>>7-a%8&1)},put:function(a,c){for(var d=0;d<c;d++)this.putBit(1==(a>>>c-d-1&1))},getLengthInBits:function(){return this.length},putBit:function(a){var c=Math.floor(this.length/8);this.buffer.length<=c&&this.buffer.push(0);a&&(this.buffer[c]|=128>>>this.length%8);this.length++}};"string"===typeof h&&(h={text:h});h=r.extend({},{render:"canvas",width:256,height:256,typeNumber:-1,
|
||||
correctLevel:2,background:"#ffffff",foreground:"#000000"},h);return this.each(function(){var a;if("canvas"==h.render){a=new o(h.typeNumber,h.correctLevel);a.addData(h.text);a.make();var c=document.createElement("canvas");c.width=h.width;c.height=h.height;for(var d=c.getContext("2d"),b=h.width/a.getModuleCount(),e=h.height/a.getModuleCount(),f=0;f<a.getModuleCount();f++)for(var i=0;i<a.getModuleCount();i++){d.fillStyle=a.isDark(f,i)?h.foreground:h.background;var g=Math.ceil((i+1)*b)-Math.floor(i*b),
|
||||
j=Math.ceil((f+1)*b)-Math.floor(f*b);d.fillRect(Math.round(i*b),Math.round(f*e),g,j)}}else{a=new o(h.typeNumber,h.correctLevel);a.addData(h.text);a.make();c=r("<table></table>").css("width",h.width+"px").css("height",h.height+"px").css("border","0px").css("border-collapse","collapse").css("background-color",h.background);d=h.width/a.getModuleCount();b=h.height/a.getModuleCount();for(e=0;e<a.getModuleCount();e++){f=r("<tr></tr>").css("height",b+"px").appendTo(c);for(i=0;i<a.getModuleCount();i++)r("<td></td>").css("width",
|
||||
d+"px").css("background-color",a.isDark(e,i)?h.foreground:h.background).appendTo(f)}}a=c;$(a).appendTo(this)})}})($);
|
||||
@@ -28,7 +28,9 @@
|
||||
|
||||
var Mnemonic = function(language) {
|
||||
|
||||
var PBKDF2_ROUNDS = 2048;
|
||||
var DOM = {};
|
||||
DOM.entropyContainer = $(".entropy-container");
|
||||
PBKDF2_ROUNDS = DOM.entropyContainer.find(".pbkdf2-rounds").val();
|
||||
var RADIX = 2048;
|
||||
|
||||
var self = this;
|
||||
@@ -97,22 +99,10 @@ var Mnemonic = function(language) {
|
||||
}
|
||||
|
||||
self.check = function(mnemonic) {
|
||||
var mnemonic = self.splitWords(mnemonic);
|
||||
if (mnemonic.length == 0 || mnemonic.length % 3 > 0) {
|
||||
return false
|
||||
var b = mnemonicToBinaryString(mnemonic);
|
||||
if (b === null) {
|
||||
return false;
|
||||
}
|
||||
// idx = map(lambda x: bin(self.wordlist.index(x))[2:].zfill(11), mnemonic)
|
||||
var idx = [];
|
||||
for (var i=0; i<mnemonic.length; i++) {
|
||||
var word = mnemonic[i];
|
||||
var wordIndex = wordlist.indexOf(word);
|
||||
if (wordIndex == -1) {
|
||||
return false;
|
||||
}
|
||||
var binaryIndex = zfill(wordIndex.toString(2), 11);
|
||||
idx.push(binaryIndex);
|
||||
}
|
||||
var b = idx.join('');
|
||||
var l = b.length;
|
||||
//d = b[:l / 33 * 32]
|
||||
//h = b[-l / 33:]
|
||||
@@ -128,6 +118,26 @@ var Mnemonic = function(language) {
|
||||
return h == nh;
|
||||
}
|
||||
|
||||
self.toRawEntropyHex = function(mnemonic) {
|
||||
var b = mnemonicToBinaryString(mnemonic);
|
||||
if (b === null)
|
||||
return null;
|
||||
var d = b.substring(0, b.length / 33 * 32);
|
||||
var nd = binaryStringToWordArray(d);
|
||||
|
||||
var h = "";
|
||||
for (var i=0; i<nd.length; i++) {
|
||||
h += ('0000000' + nd[i].toString(16)).slice(-8);
|
||||
}
|
||||
return h;
|
||||
}
|
||||
|
||||
self.toRawEntropyBin = function(mnemonic) {
|
||||
var b = mnemonicToBinaryString(mnemonic);
|
||||
var d = b.substring(0, b.length / 33 * 32);
|
||||
return d;
|
||||
}
|
||||
|
||||
self.toSeed = function(mnemonic, passphrase) {
|
||||
passphrase = passphrase || '';
|
||||
mnemonic = self.joinWords(self.splitWords(mnemonic)); // removes duplicate blanks
|
||||
@@ -156,14 +166,7 @@ var Mnemonic = function(language) {
|
||||
}
|
||||
|
||||
self.normalizeString = function(str) {
|
||||
if (typeof str.normalize == "function") {
|
||||
return str.normalize("NFKD");
|
||||
}
|
||||
else {
|
||||
// TODO decide how to handle this in the future.
|
||||
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/normalize
|
||||
return str;
|
||||
}
|
||||
return str.normalize("NFKD");
|
||||
}
|
||||
|
||||
function byteArrayToWordArray(data) {
|
||||
@@ -207,6 +210,25 @@ var Mnemonic = function(language) {
|
||||
return a;
|
||||
}
|
||||
|
||||
function mnemonicToBinaryString(mnemonic) {
|
||||
var mnemonic = self.splitWords(mnemonic);
|
||||
if (mnemonic.length == 0 || mnemonic.length % 3 > 0) {
|
||||
return null;
|
||||
}
|
||||
// idx = map(lambda x: bin(self.wordlist.index(x))[2:].zfill(11), mnemonic)
|
||||
var idx = [];
|
||||
for (var i=0; i<mnemonic.length; i++) {
|
||||
var word = mnemonic[i];
|
||||
var wordIndex = wordlist.indexOf(word);
|
||||
if (wordIndex == -1) {
|
||||
return null;
|
||||
}
|
||||
var binaryIndex = zfill(wordIndex.toString(2), 11);
|
||||
idx.push(binaryIndex);
|
||||
}
|
||||
return idx.join('');
|
||||
}
|
||||
|
||||
// Pad a numeric string on the left with zero digits until the given width
|
||||
// is reached.
|
||||
// Note this differs to the python implementation because it does not
|
||||
|
||||
@@ -1,211 +0,0 @@
|
||||
(function() {
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* Extend an Object with another Object's properties.
|
||||
*
|
||||
* The source objects are specified as additional arguments.
|
||||
*
|
||||
* @param dst Object the object to extend.
|
||||
*
|
||||
* @return Object the final object.
|
||||
*/
|
||||
var _extend = function(dst) {
|
||||
var sources = Array.prototype.slice.call(arguments, 1);
|
||||
for (var i=0; i<sources.length; ++i) {
|
||||
var src = sources[i];
|
||||
for (var p in src) {
|
||||
if (src.hasOwnProperty(p)) dst[p] = src[p];
|
||||
}
|
||||
}
|
||||
return dst;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Defer execution of given function.
|
||||
* @param {Function} func
|
||||
*/
|
||||
var _defer = function(func) {
|
||||
if (typeof setImmediate === 'function') {
|
||||
return setImmediate(func);
|
||||
} else {
|
||||
return setTimeout(func, 0);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Based on the algorithm at http://en.wikipedia.org/wiki/Levenshtein_distance.
|
||||
*/
|
||||
var Levenshtein = {
|
||||
/**
|
||||
* Calculate levenshtein distance of the two strings.
|
||||
*
|
||||
* @param str1 String the first string.
|
||||
* @param str2 String the second string.
|
||||
* @return Integer the levenshtein distance (0 and above).
|
||||
*/
|
||||
get: function(str1, str2) {
|
||||
// base cases
|
||||
if (str1 === str2) return 0;
|
||||
if (str1.length === 0) return str2.length;
|
||||
if (str2.length === 0) return str1.length;
|
||||
|
||||
// two rows
|
||||
var prevRow = new Array(str2.length + 1),
|
||||
curCol, nextCol, i, j, tmp;
|
||||
|
||||
// initialise previous row
|
||||
for (i=0; i<prevRow.length; ++i) {
|
||||
prevRow[i] = i;
|
||||
}
|
||||
|
||||
// calculate current row distance from previous row
|
||||
for (i=0; i<str1.length; ++i) {
|
||||
nextCol = i + 1;
|
||||
|
||||
for (j=0; j<str2.length; ++j) {
|
||||
curCol = nextCol;
|
||||
|
||||
// substution
|
||||
nextCol = prevRow[j] + ( (str1.charAt(i) === str2.charAt(j)) ? 0 : 1 );
|
||||
// insertion
|
||||
tmp = curCol + 1;
|
||||
if (nextCol > tmp) {
|
||||
nextCol = tmp;
|
||||
}
|
||||
// deletion
|
||||
tmp = prevRow[j + 1] + 1;
|
||||
if (nextCol > tmp) {
|
||||
nextCol = tmp;
|
||||
}
|
||||
|
||||
// copy current col value into previous (in preparation for next iteration)
|
||||
prevRow[j] = curCol;
|
||||
}
|
||||
|
||||
// copy last col value into previous (in preparation for next iteration)
|
||||
prevRow[j] = nextCol;
|
||||
}
|
||||
|
||||
return nextCol;
|
||||
},
|
||||
|
||||
/**
|
||||
* Asynchronously calculate levenshtein distance of the two strings.
|
||||
*
|
||||
* @param str1 String the first string.
|
||||
* @param str2 String the second string.
|
||||
* @param cb Function callback function with signature: function(Error err, int distance)
|
||||
* @param [options] Object additional options.
|
||||
* @param [options.progress] Function progress callback with signature: function(percentComplete)
|
||||
*/
|
||||
getAsync: function(str1, str2, cb, options) {
|
||||
options = _extend({}, {
|
||||
progress: null
|
||||
}, options);
|
||||
|
||||
// base cases
|
||||
if (str1 === str2) return cb(null, 0);
|
||||
if (str1.length === 0) return cb(null, str2.length);
|
||||
if (str2.length === 0) return cb(null, str1.length);
|
||||
|
||||
// two rows
|
||||
var prevRow = new Array(str2.length + 1),
|
||||
curCol, nextCol,
|
||||
i, j, tmp,
|
||||
startTime, currentTime;
|
||||
|
||||
// initialise previous row
|
||||
for (i=0; i<prevRow.length; ++i) {
|
||||
prevRow[i] = i;
|
||||
}
|
||||
|
||||
nextCol = 1;
|
||||
i = 0;
|
||||
j = -1;
|
||||
|
||||
var __calculate = function() {
|
||||
// reset timer
|
||||
startTime = new Date().valueOf();
|
||||
currentTime = startTime;
|
||||
|
||||
// keep going until one second has elapsed
|
||||
while (currentTime - startTime < 1000) {
|
||||
// reached end of current row?
|
||||
if (str2.length <= (++j)) {
|
||||
// copy current into previous (in preparation for next iteration)
|
||||
prevRow[j] = nextCol;
|
||||
|
||||
// if already done all chars
|
||||
if (str1.length <= (++i)) {
|
||||
return cb(null, nextCol);
|
||||
}
|
||||
// else if we have more left to do
|
||||
else {
|
||||
nextCol = i + 1;
|
||||
j = 0;
|
||||
}
|
||||
}
|
||||
|
||||
// calculation
|
||||
curCol = nextCol;
|
||||
|
||||
// substution
|
||||
nextCol = prevRow[j] + ( (str1.charAt(i) === str2.charAt(j)) ? 0 : 1 );
|
||||
// insertion
|
||||
tmp = curCol + 1;
|
||||
if (nextCol > tmp) {
|
||||
nextCol = tmp;
|
||||
}
|
||||
// deletion
|
||||
tmp = prevRow[j + 1] + 1;
|
||||
if (nextCol > tmp) {
|
||||
nextCol = tmp;
|
||||
}
|
||||
|
||||
// copy current into previous (in preparation for next iteration)
|
||||
prevRow[j] = curCol;
|
||||
|
||||
// get current time
|
||||
currentTime = new Date().valueOf();
|
||||
}
|
||||
|
||||
// send a progress update?
|
||||
if (null !== options.progress) {
|
||||
try {
|
||||
options.progress.call(null, (i * 100.0/ str1.length));
|
||||
} catch (err) {
|
||||
return cb('Progress callback: ' + err.toString());
|
||||
}
|
||||
}
|
||||
|
||||
// next iteration
|
||||
_defer(__calculate);
|
||||
};
|
||||
|
||||
__calculate();
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
// amd
|
||||
if (typeof define !== "undefined" && define !== null && define.amd) {
|
||||
define(function() {
|
||||
return Levenshtein;
|
||||
});
|
||||
}
|
||||
// commonjs
|
||||
else if (typeof module !== "undefined" && module !== null && typeof exports !== "undefined" && module.exports === exports) {
|
||||
module.exports = Levenshtein;
|
||||
}
|
||||
// web worker
|
||||
else if (typeof self !== "undefined" && typeof self.postMessage === 'function' && typeof self.importScripts === 'function') {
|
||||
self.Levenshtein = Levenshtein;
|
||||
}
|
||||
// browser main thread
|
||||
else if (typeof window !== "undefined" && window !== null) {
|
||||
window.Levenshtein = Levenshtein;
|
||||
}
|
||||
}());
|
||||
|
||||
@@ -1,94 +0,0 @@
|
||||
Translate.loadForeignPhrases("en",
|
||||
{
|
||||
"<code>m/44'/0'/0'/0</code> generates public addresses": "<code>m/44'/0'/0'/0</code> generates public addresses",
|
||||
"<code>m/44'/0'/0'/1</code> generates change addresses": "<code>m/44'/0'/0'/1</code> generates change addresses",
|
||||
"<code>m/44'/0'/0'</code> generates extended keys for import / export": "<code>m/44'/0'/0'</code> generates extended keys for import / export",
|
||||
"<code>m/44'/0'/1'</code> for the next account. Continue incrementing for more accounts (most use a single account).": "<code>m/44'/0'/1'</code> for the next account. Continue incrementing for more accounts (most use a single account).",
|
||||
"Accepts binary, base 6, 6-sided dice, base 10, hexadecimal, cards": "Accepts binary, base 6, 6-sided dice, base 10, hexadecimal, cards",
|
||||
"Account": "Account",
|
||||
"Address": "Address",
|
||||
"Alternatively, download the file from the repository": "Alternatively, download the file from the repository",
|
||||
"BIP32 Derivation Path": "BIP32 Derivation Path",
|
||||
"BIP32 Extended Key": "BIP32 Extended Key",
|
||||
"BIP32 Extended Key (addresses only)": "BIP32 Extended Key (addresses only)",
|
||||
"BIP32 Root Key": "BIP32 Root Key",
|
||||
"BIP39 Mnemonic": "BIP39 Mnemonic",
|
||||
"BIP39 Passphrase (optional)": "BIP39 Passphrase (optional)",
|
||||
"BIP39 Seed": "BIP39 Seed",
|
||||
"Base 10": "Base 10",
|
||||
"Base 6": "Base 6",
|
||||
"Be careful - it can be easy to make mistakes if you don't know what you're doing.": "Be careful - it can be easy to make mistakes if you don't know what you're doing.",
|
||||
"Binary": "Binary",
|
||||
"Bitcoin Core": "Bitcoin Core",
|
||||
"Bits Per Event": "Bits Per Event",
|
||||
"Block Explorers": "Block Explorers",
|
||||
"Can be used with": "Can be used with",
|
||||
"Card": "Card",
|
||||
"Coin": "Coin",
|
||||
"Dice": "Dice",
|
||||
"Do <strong>NOT</strong> use phrases from books, lyrics from songs, your birthday or steet address, keyboard mashing, or anything you <i>think</i> is random, because chances are overwhelming it isn't random enough for the needs of this tool.": "Do <strong>NOT</strong> use phrases from books, lyrics from songs, your birthday or steet address, keyboard mashing, or anything you <i>think</i> is random, because chances are overwhelming it isn't random enough for the needs of this tool.",
|
||||
"Double-click that file to open it in a browser on any offline computer.": "Double-click that file to open it in a browser on any offline computer.",
|
||||
"Entropy": "Entropy",
|
||||
"Entropy Type": "Entropy Type",
|
||||
"Entropy is an advanced feature. Your mnemonic may be insecure if this feature is used incorrectly.": "Entropy is an advanced feature. Your mnemonic may be insecure if this feature is used incorrectly.",
|
||||
"Entropy values must be sourced from a <a href=\"https://en.wikipedia.org/wiki/Random_number_generation\" target=\"_blank\">strong source of randomness</a>.": "Entropy values must be sourced from a <a href=\"https://en.wikipedia.org/wiki/Random_number_generation\" target=\"_blank\">strong source of randomness</a>.",
|
||||
"Event Count": "Event Count",
|
||||
"External / Internal": "External / Internal",
|
||||
"Filtered Entropy": "Filtered Entropy",
|
||||
"For more info see the <a href=\"http://www.mycelium.com/\" target=\"_blank\">Mycelium Wallet homepage</a>": "For more info see the <a href=\"http://www.mycelium.com/\" target=\"_blank\">Mycelium Wallet homepage</a>",
|
||||
"For more info see the <a href=\"https://github.com/bitcoin/bips/blob/master/bip-0039.mediawiki\" target=\"_blank\">BIP39 spec</a>.": "For more info see the <a href=\"https://github.com/bitcoin/bips/blob/master/bip-0039.mediawiki\" target=\"_blank\">BIP39 spec</a>.",
|
||||
"For more info see the <a href=\"https://github.com/bitcoin/bips/blob/master/bip-0044.mediawiki\" target=\"_blank\">BIP44 spec</a>.": "For more info see the <a href=\"https://github.com/bitcoin/bips/blob/master/bip-0044.mediawiki\" target=\"_blank\">BIP44 spec</a>.",
|
||||
"For more info see the <a href=\"https://github.com/bitcoin/bitcoin/pull/8035\" target=\"_blank\">Bitcoin Core BIP32 implementation</a>": "For more info see the <a href=\"https://github.com/bitcoin/bitcoin/pull/8035\" target=\"_blank\">Bitcoin Core BIP32 implementation</a>",
|
||||
"For more info see the BIP32 spec": "For more info see the BIP32 spec",
|
||||
"From entropy length (3 words per 32 bits)": "From entropy length (3 words per 32 bits)",
|
||||
"Generate a random mnemonic, or enter your own below": "Generate a random mnemonic, or enter your own below",
|
||||
"Get the source code from the repository": "Get the source code from the repository",
|
||||
"Hex": "Hex",
|
||||
"Hierarchical Deterministic Wallets": "Hierarchical Deterministic Wallets",
|
||||
"If cryptographic randomness isn't available in your browser, this page will show a warning and the generate button will not work.": "If cryptographic randomness isn't available in your browser, this page will show a warning and the generate button will not work.",
|
||||
"In that case you might choose to use your own source of entropy.": "In that case you might choose to use your own source of entropy.",
|
||||
"In your browser, select file save-as, and save this page as a file.": "In your browser, select file save-as, and save this page as a file.",
|
||||
"Libraries": "Libraries",
|
||||
"Mnemonic Language": "Mnemonic Language",
|
||||
"Mnemonic Length": "Mnemonic Length",
|
||||
"Mnemonic code for generating deterministic keys": "Mnemonic code for generating deterministic keys",
|
||||
"More info": "More info",
|
||||
"Multi-Account Hierarchy for Deterministic Wallets": "Multi-Account Hierarchy for Deterministic Wallets",
|
||||
"Mycelium Wallet": "Mycelium Wallet",
|
||||
"Note these addreses are derived from the BIP32 Extended Key": "Note these addreses are derived from the BIP32 Extended Key",
|
||||
"Offline Usage": "Offline Usage",
|
||||
"Only enter the <code>xpub</code> extended key into block explorer search fields, never the <code>xprv</code> key.": "Only enter the <code>xpub</code> extended key into block explorer search fields, never the <code>xprv</code> key.",
|
||||
"Path": "Path",
|
||||
"Private Key": "Private Key",
|
||||
"Private Keys": "Private Keys",
|
||||
"Public Key": "Public Key",
|
||||
"Purpose": "Purpose",
|
||||
"Raw Binary": "Raw Binary",
|
||||
"Read more": "Read more",
|
||||
"Read more at the <a href=\"https://github.com/bitcoin/bips/blob/master/bip-0032.mediawiki\" target=\"_blank\">official BIP32 spec</a>": "Read more at the <a href=\"https://github.com/bitcoin/bips/blob/master/bip-0032.mediawiki\" target=\"_blank\">official BIP32 spec</a>",
|
||||
"Read more at the <a href=\"https://github.com/bitcoin/bips/blob/master/bip-0039.mediawiki\">official BIP39 spec</a>": "Read more at the <a href=\"https://github.com/bitcoin/bips/blob/master/bip-0039.mediawiki\">official BIP39 spec</a>",
|
||||
"Read more at the <a href=\"https://github.com/bitcoin/bips/blob/master/bip-0044.mediawiki\" target=\"_blank\">official BIP44 spec</a>": "Read more at the <a href=\"https://github.com/bitcoin/bips/blob/master/bip-0044.mediawiki\" target=\"_blank\">official BIP44 spec</a>",
|
||||
"See the demo at <a href=\"http://bip32.org/\" target=\"_blank\">bip32.org</a>": "See the demo at <a href=\"http://bip32.org/\" target=\"_blank\">bip32.org</a>",
|
||||
"Show": "Show",
|
||||
"Show more rows": "Show more rows",
|
||||
"Strength": "Strength",
|
||||
"Supply my own source of entropy": "Supply my own source of entropy",
|
||||
"The built in random generator can generally be trusted more than your own intuition about randomness.": "The built in random generator can generally be trusted more than your own intuition about randomness.",
|
||||
"The random mnemonic generator on this page uses a <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/RandomSource/getRandomValues\" target=\"_blank\">cryptographically secure random number generator</a>.": "The random mnemonic generator on this page uses a <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/RandomSource/getRandomValues\" target=\"_blank\">cryptographically secure random number generator</a>.",
|
||||
"This means flipping a fair coin, rolling a fair dice, noise measurements etc.": "This means flipping a fair coin, rolling a fair dice, noise measurements etc.",
|
||||
"This project is 100% open-source code": "This project is 100% open-source code",
|
||||
"Toggle": "Toggle",
|
||||
"Total Bits": "Total Bits",
|
||||
"Use hardened addresses": "Use hardened addresses",
|
||||
"Use path <code>m/0'/0'</code> with hardened addresses.": "Use path <code>m/0'/0'</code> with hardened addresses.",
|
||||
"Use path <code>m/44'/0'/0'</code>.": "Use path <code>m/44'/0'/0'</code>.",
|
||||
"Use private keys at <a href=\"https://web.archive.org/web/20150707020924/https://brainwallet.org/\" target=\"_blank\">brainwallet.org</a>.": "Use private keys at <a href=\"https://web.archive.org/web/20150707020924/https://brainwallet.org/\" target=\"_blank\">brainwallet.org</a>.",
|
||||
"Valid entropy values include:": "Valid entropy values include:",
|
||||
"Warning": "Warning",
|
||||
"Word Count": "Word Count",
|
||||
"You are not a good source of entropy.": "You are not a good source of entropy.",
|
||||
"You can enter an existing BIP39 mnemonic, or generate a new random one. Typing your own twelve words will probably not work how you expect, since the words require a particular structure (the last word is a checksum).": "You can enter an existing BIP39 mnemonic, or generate a new random one. Typing your own twelve words will probably not work how you expect, since the words require a particular structure (the last word is a checksum).",
|
||||
"You can use this tool without having to be online.": "You can use this tool without having to be online.",
|
||||
"words": "words"
|
||||
}
|
||||
);
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,10 +1,10 @@
|
||||
function convertRippleAdrr(address) {
|
||||
return window.basex('rpshnaf39wBUDNEGHJKLM4PQRST7VWXYZ2bcdeCg65jkm8oFqi1tuvAxyz').encode(
|
||||
window.basex('123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz').decode(address)
|
||||
return libs.basex('rpshnaf39wBUDNEGHJKLM4PQRST7VWXYZ2bcdeCg65jkm8oFqi1tuvAxyz').encode(
|
||||
libs.basex('123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz').decode(address)
|
||||
)
|
||||
}
|
||||
|
||||
function convertRipplePriv(priv) {
|
||||
return window.basex('123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz').decode(priv).toString("hex").slice(2,66)
|
||||
}
|
||||
|
||||
return libs.basex('123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz').decode(priv).toString("hex").slice(2,66)
|
||||
}
|
||||
|
||||
|
||||
768
src/js/segwit-parameters.js
Normal file
768
src/js/segwit-parameters.js
Normal file
@@ -0,0 +1,768 @@
|
||||
(function() {
|
||||
|
||||
// p2wpkh
|
||||
|
||||
libs.bitcoin.networks.bitcoin.p2wpkh = {
|
||||
baseNetwork: "bitcoin",
|
||||
messagePrefix: '\x18Bitcoin Signed Message:\n',
|
||||
bech32: 'bc',
|
||||
bip32: {
|
||||
public: 0x04b24746,
|
||||
private: 0x04b2430c
|
||||
},
|
||||
pubKeyHash: 0x00,
|
||||
scriptHash: 0x05,
|
||||
wif: 0x80
|
||||
};
|
||||
|
||||
libs.bitcoin.networks.testnet.p2wpkh = {
|
||||
baseNetwork: "testnet",
|
||||
messagePrefix: '\x18Bitcoin Signed Message:\n',
|
||||
bech32: 'tb',
|
||||
bip32: {
|
||||
public: 0x045f1cf6,
|
||||
private: 0x045f18bc
|
||||
},
|
||||
pubKeyHash: 0x6f,
|
||||
scriptHash: 0xc4,
|
||||
wif: 0xef
|
||||
};
|
||||
|
||||
libs.bitcoin.networks.regtest.p2wpkh = {
|
||||
baseNetwork: "regtest",
|
||||
messagePrefix: '\x18Bitcoin Signed Message:\n',
|
||||
bech32: 'bcrt',
|
||||
bip32: {
|
||||
public: 0x045f1cf6,
|
||||
private: 0x045f18bc
|
||||
},
|
||||
pubKeyHash: 0x6f,
|
||||
scriptHash: 0xc4,
|
||||
wif: 0xef
|
||||
};
|
||||
|
||||
// p2wpkh in p2sh
|
||||
|
||||
libs.bitcoin.networks.bitcoin.p2wpkhInP2sh = {
|
||||
baseNetwork: "bitcoin",
|
||||
messagePrefix: '\x18Bitcoin Signed Message:\n',
|
||||
bech32: 'bc',
|
||||
bip32: {
|
||||
public: 0x049d7cb2,
|
||||
private: 0x049d7878
|
||||
},
|
||||
pubKeyHash: 0x00,
|
||||
scriptHash: 0x05,
|
||||
wif: 0x80
|
||||
};
|
||||
|
||||
libs.bitcoin.networks.testnet.p2wpkhInP2sh = {
|
||||
baseNetwork: "testnet",
|
||||
messagePrefix: '\x18Bitcoin Signed Message:\n',
|
||||
bech32: 'tb',
|
||||
bip32: {
|
||||
public: 0x044a5262,
|
||||
private: 0x044a4e28
|
||||
},
|
||||
pubKeyHash: 0x6f,
|
||||
scriptHash: 0xc4,
|
||||
wif: 0xef
|
||||
};
|
||||
|
||||
libs.bitcoin.networks.regtest.p2wpkhInP2sh = {
|
||||
baseNetwork: "regtest",
|
||||
messagePrefix: '\x18Bitcoin Signed Message:\n',
|
||||
bech32: 'bcrt',
|
||||
bip32: {
|
||||
public: 0x044a5262,
|
||||
private: 0x044a4e28
|
||||
},
|
||||
pubKeyHash: 0x6f,
|
||||
scriptHash: 0xc4,
|
||||
wif: 0xef
|
||||
};
|
||||
|
||||
// p2wsh
|
||||
|
||||
libs.bitcoin.networks.bitcoin.p2wsh = {
|
||||
baseNetwork: "bitcoin",
|
||||
messagePrefix: '\x18Bitcoin Signed Message:\n',
|
||||
bech32: 'bc',
|
||||
bip32: {
|
||||
public: 0x02aa7ed3,
|
||||
private: 0x02aa7a99
|
||||
},
|
||||
pubKeyHash: 0x00,
|
||||
scriptHash: 0x05,
|
||||
wif: 0x80
|
||||
};
|
||||
|
||||
libs.bitcoin.networks.testnet.p2wsh = {
|
||||
baseNetwork: "testnet",
|
||||
messagePrefix: '\x18Bitcoin Signed Message:\n',
|
||||
bech32: 'tb',
|
||||
bip32: {
|
||||
public: 0x02575483,
|
||||
private: 0x02575048
|
||||
},
|
||||
pubKeyHash: 0x6f,
|
||||
scriptHash: 0xc4,
|
||||
wif: 0xef
|
||||
};
|
||||
|
||||
libs.bitcoin.networks.regtest.p2wsh = {
|
||||
baseNetwork: "regtest",
|
||||
messagePrefix: '\x18Bitcoin Signed Message:\n',
|
||||
bech32: 'bcrt',
|
||||
bip32: {
|
||||
public: 0x02575483,
|
||||
private: 0x02575048
|
||||
},
|
||||
pubKeyHash: 0x6f,
|
||||
scriptHash: 0xc4,
|
||||
wif: 0xef
|
||||
};
|
||||
|
||||
// p2wsh in p2sh
|
||||
|
||||
libs.bitcoin.networks.bitcoin.p2wshInP2sh = {
|
||||
baseNetwork: "bitcoin",
|
||||
messagePrefix: '\x18Bitcoin Signed Message:\n',
|
||||
bech32: 'bc',
|
||||
bip32: {
|
||||
public: 0x0295b43f,
|
||||
private: 0x0295b005
|
||||
},
|
||||
pubKeyHash: 0x00,
|
||||
scriptHash: 0x05,
|
||||
wif: 0x80
|
||||
};
|
||||
|
||||
libs.bitcoin.networks.testnet.p2wshInP2sh = {
|
||||
baseNetwork: "testnet",
|
||||
messagePrefix: '\x18Bitcoin Signed Message:\n',
|
||||
bech32: 'tb',
|
||||
bip32: {
|
||||
public: 0x024289ef,
|
||||
private: 0x024285b5
|
||||
},
|
||||
pubKeyHash: 0x6f,
|
||||
scriptHash: 0xc4,
|
||||
wif: 0xef
|
||||
};
|
||||
|
||||
libs.bitcoin.networks.regtest.p2wshInP2sh = {
|
||||
baseNetwork: "regtest",
|
||||
messagePrefix: '\x18Bitcoin Signed Message:\n',
|
||||
bech32: 'bcrt',
|
||||
bip32: {
|
||||
public: 0x024289ef,
|
||||
private: 0x024285b5
|
||||
},
|
||||
pubKeyHash: 0x6f,
|
||||
scriptHash: 0xc4,
|
||||
wif: 0xef
|
||||
};
|
||||
|
||||
libs.bitcoin.networks.cranepay.p2wpkhInP2sh = {
|
||||
baseNetwork: "cranepay",
|
||||
messagePrefix: '\x18Bitcoin Signed Message:\n',
|
||||
bech32: 'cp',
|
||||
bip32: {
|
||||
public: 0x049d7cb2,
|
||||
private: 0x049d7878
|
||||
},
|
||||
pubKeyHash: 28,
|
||||
scriptHash: 10,
|
||||
wif: 123
|
||||
};
|
||||
|
||||
// bech32
|
||||
libs.bitcoin.networks.cranepay.p2wpkh = {
|
||||
baseNetwork: "cranepay",
|
||||
messagePrefix: '\x18Bitcoin Signed Message:\n',
|
||||
bech32: 'cp',
|
||||
bip32: {
|
||||
public: 0x04b24746,
|
||||
private: 0x04b2430c
|
||||
},
|
||||
pubKeyHash: 28,
|
||||
scriptHash: 10,
|
||||
wif: 123
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
libs.bitcoin.networks.litecoin.p2wpkh = {
|
||||
baseNetwork: "litecoin",
|
||||
messagePrefix: '\x19Litecoin Signed Message:\n',
|
||||
bech32: 'ltc',
|
||||
bip32: {
|
||||
public: 0x04b24746,
|
||||
private: 0x04b2430c
|
||||
},
|
||||
pubKeyHash: 0x30,
|
||||
scriptHash: 0x32,
|
||||
wif: 0xb0
|
||||
};
|
||||
|
||||
libs.bitcoin.networks.litecoin.p2wpkhInP2sh = {
|
||||
baseNetwork: "litecoin",
|
||||
messagePrefix: '\x19Litecoin Signed Message:\n',
|
||||
bech32: 'ltc',
|
||||
bip32: {
|
||||
public: 0x01b26ef6,
|
||||
private: 0x01b26792
|
||||
},
|
||||
pubKeyHash: 0x30,
|
||||
scriptHash: 0x32,
|
||||
wif: 0xb0
|
||||
};
|
||||
|
||||
libs.bitcoin.networks.fujicoin.p2wpkh = {
|
||||
baseNetwork: "fujicoin",
|
||||
messagePrefix: '\x19FujiCoin Signed Message:\n',
|
||||
bech32: 'fc',
|
||||
bip32: {
|
||||
public: 0x04b24746,
|
||||
private: 0x04b2430c
|
||||
},
|
||||
pubKeyHash: 0x24,
|
||||
scriptHash: 0x10,
|
||||
wif: 0xa4
|
||||
};
|
||||
|
||||
libs.bitcoin.networks.fujicoin.p2wpkhInP2sh = {
|
||||
baseNetwork: "fujicoin",
|
||||
messagePrefix: '\x19FujiCoin Signed Message:\n',
|
||||
bech32: 'fc',
|
||||
bip32: {
|
||||
public: 0x049d7cb2,
|
||||
private: 0x049d7878
|
||||
},
|
||||
pubKeyHash: 0x24,
|
||||
scriptHash: 0x10,
|
||||
wif: 0xa4
|
||||
};
|
||||
|
||||
libs.bitcoin.networks.vertcoin.p2wpkh = {
|
||||
baseNetwork: "vertcoin",
|
||||
messagePrefix: '\x18Vertcoin Signed Message:\n',
|
||||
bech32: 'vtc',
|
||||
bip32: {
|
||||
public: 0x0488b21e,
|
||||
private: 0x0488ade4
|
||||
},
|
||||
pubKeyHash: 71,
|
||||
scriptHash: 5,
|
||||
wif: 0x80
|
||||
};
|
||||
|
||||
libs.bitcoin.networks.vertcoin.p2wpkhInP2sh = {
|
||||
baseNetwork: "vertcoin",
|
||||
messagePrefix: '\x18Vertcoin Signed Message:\n',
|
||||
bip32: {
|
||||
public: 0x0488b21e,
|
||||
private: 0x0488ade4
|
||||
},
|
||||
pubKeyHash: 71,
|
||||
scriptHash: 5,
|
||||
wif: 0x80
|
||||
};
|
||||
|
||||
libs.bitcoin.networks.bgold.p2wpkh = {
|
||||
baseNetwork: "bgold",
|
||||
messagePrefix: '\x1DBitcoin Gold Signed Message:\n',
|
||||
bech32: 'btg',
|
||||
bip32: {
|
||||
public: 0x04b24746,
|
||||
private: 0x04b2430c
|
||||
},
|
||||
pubKeyHash: 0x26,
|
||||
scriptHash: 0x17,
|
||||
wif: 0x80,
|
||||
};
|
||||
|
||||
libs.bitcoin.networks.bgold.p2wpkhInP2sh = {
|
||||
baseNetwork: "bgold",
|
||||
messagePrefix: '\x1DBitcoin Gold Signed Message:\n',
|
||||
bech32: 'btg',
|
||||
bip32: {
|
||||
public: 0x049d7cb2,
|
||||
private: 0x049d7878
|
||||
},
|
||||
pubKeyHash: 0x26,
|
||||
scriptHash: 0x17,
|
||||
wif: 0x80,
|
||||
};
|
||||
|
||||
libs.bitcoin.networks.digibyte.p2wpkh = {
|
||||
baseNetwork: "digibyte",
|
||||
messagePrefix: 'x19DigiByte Signed Message:\n',
|
||||
bech32: 'dgb',
|
||||
bip32: {
|
||||
public: 0x04b24746,
|
||||
private: 0x04b2430c
|
||||
},
|
||||
pubKeyHash: 0x1e,
|
||||
scriptHash: 0x3f,
|
||||
wif: 0x80
|
||||
};
|
||||
|
||||
libs.bitcoin.networks.digibyte.p2wpkhInP2sh = {
|
||||
baseNetwork: "digibyte",
|
||||
messagePrefix: '\x19DigiByte Signed Message:\n',
|
||||
bech32: 'dgb',
|
||||
bip32: {
|
||||
public: 0x049d7cb2,
|
||||
private: 0x049d7878
|
||||
},
|
||||
pubKeyHash: 0x1e,
|
||||
scriptHash: 0x3f,
|
||||
wif: 0x80
|
||||
};
|
||||
|
||||
libs.bitcoin.networks.blockstamp.p2wpkh = {
|
||||
baseNetwork: "blockstamp",
|
||||
messagePrefix: '\x18BlockStamp Signed Message:\n',
|
||||
bech32: 'bc',
|
||||
bip32: {
|
||||
public: 0x0488B21E,
|
||||
private: 0x0488ADE4,
|
||||
},
|
||||
pubKeyHash: 0x00,
|
||||
scriptHash: 0x05,
|
||||
wif: 0x80,
|
||||
};
|
||||
|
||||
libs.bitcoin.networks.blockstamp.p2wpkhInP2sh = {
|
||||
baseNetwork: "blockstamp",
|
||||
messagePrefix: '\x18BlockStamp Signed Message:\n',
|
||||
bech32: 'bc',
|
||||
bip32: {
|
||||
public: 0x0488B21E,
|
||||
private: 0x0488ADE4,
|
||||
},
|
||||
pubKeyHash: 0x00,
|
||||
scriptHash: 0x05,
|
||||
wif: 0x80,
|
||||
};
|
||||
|
||||
libs.bitcoin.networks.nix.p2wpkh = {
|
||||
baseNetwork: "nix",
|
||||
messagePrefix: '\x18Nix Signed Message:\n',
|
||||
bech32: 'nix',
|
||||
bip32: {
|
||||
public: 0x0488b21e,
|
||||
private: 0x0488ade4,
|
||||
},
|
||||
pubKeyHash: 0x26,
|
||||
scriptHash: 0x35,
|
||||
wif: 0x80,
|
||||
};
|
||||
|
||||
libs.bitcoin.networks.nix.p2wpkhInP2sh = {
|
||||
baseNetwork: "nix",
|
||||
messagePrefix: '\x18Nix Signed Message:\n',
|
||||
bech32: 'nix',
|
||||
bip32: {
|
||||
public: 0x0488b21e,
|
||||
private: 0x0488ade4,
|
||||
},
|
||||
pubKeyHash: 0x26,
|
||||
scriptHash: 0x35,
|
||||
wif: 0x80,
|
||||
};
|
||||
|
||||
libs.bitcoin.networks.cpuchain.p2wpkh = {
|
||||
baseNetwork: "cpuchain",
|
||||
messagePrefix: '\x1DCPUchain Signed Message:\n',
|
||||
bech32: 'cpu',
|
||||
bip32: {
|
||||
public: 0x04b24746,
|
||||
private: 0x04b2430c
|
||||
},
|
||||
pubKeyHash: 0x1c,
|
||||
scriptHash: 0x1e,
|
||||
wif: 0x80,
|
||||
};
|
||||
|
||||
libs.bitcoin.networks.cpuchain.p2wpkhInP2sh = {
|
||||
baseNetwork: "cpuchain",
|
||||
messagePrefix: '\x1DCPUchain Signed Message:\n',
|
||||
bech32: 'cpu',
|
||||
bip32: {
|
||||
public: 0x049d7cb2,
|
||||
private: 0x049d7878
|
||||
},
|
||||
pubKeyHash: 0x1c,
|
||||
scriptHash: 0x1e,
|
||||
wif: 0x80,
|
||||
};
|
||||
|
||||
libs.bitcoin.networks.monkeyproject.p2wpkh = {
|
||||
baseNetwork: "monkeyproject",
|
||||
messagePrefix: 'Monkey Signed Message:\n',
|
||||
bech32: 'monkey',
|
||||
bip32: {
|
||||
public: 0x0488b21e,
|
||||
private: 0x0488dde4
|
||||
},
|
||||
pubKeyHash: 0x33,
|
||||
scriptHash: 0x1c,
|
||||
wif: 0x37
|
||||
};
|
||||
|
||||
libs.bitcoin.networks.monkeyproject.p2wpkhInP2sh = {
|
||||
baseNetwork: "monkeyproject",
|
||||
messagePrefix: 'Monkey Signed Message:\n',
|
||||
bech32: 'monkey',
|
||||
bip32: {
|
||||
public: 0x0488b21e,
|
||||
private: 0x0488dde4
|
||||
},
|
||||
pubKeyHash: 0x33,
|
||||
scriptHash: 0x1c,
|
||||
wif: 0x37
|
||||
};
|
||||
|
||||
libs.bitcoin.networks.atom.p2wpkh = {
|
||||
baseNetwork: "atom",
|
||||
messagePrefix: '\x18Bitcoin Atom Signed Message:\n',
|
||||
bech32: 'atom',
|
||||
bip32: {
|
||||
public: 0x0488B21E,
|
||||
private: 0x0488ADE4
|
||||
},
|
||||
pubKeyHash: 0x17,
|
||||
scriptHash: 0x0a,
|
||||
wif: 0x80
|
||||
};
|
||||
|
||||
libs.bitcoin.networks.atom.p2wpkhInP2sh = {
|
||||
baseNetwork: "atom",
|
||||
messagePrefix: '\x18Bitcoin Atom Signed Message:\n',
|
||||
bech32: 'atom',
|
||||
bip32: {
|
||||
public: 0x0488B21E,
|
||||
private: 0x0488ADE4
|
||||
},
|
||||
pubKeyHash: 0x17,
|
||||
scriptHash: 0x0a,
|
||||
wif: 0x80
|
||||
};
|
||||
|
||||
libs.bitcoin.networks.bitcore.p2wpkh = {
|
||||
baseNetwork: "bitcore",
|
||||
messagePrefix: '\x18BitCore Signed Message:\n',
|
||||
bech32: 'bitcore',
|
||||
bip32: {
|
||||
public: 0x0488B21E,
|
||||
private: 0x0488ADE4
|
||||
},
|
||||
pubKeyHash: 0x03,
|
||||
scriptHash: 0x7D,
|
||||
wif: 0x80
|
||||
};
|
||||
|
||||
libs.bitcoin.networks.bitcore.p2wpkhInP2sh = {
|
||||
baseNetwork: "bitcore",
|
||||
messagePrefix: '\x18BitCore Signed Message:\n',
|
||||
bech32: 'bitcore',
|
||||
bip32: {
|
||||
public: 0x0488B21E,
|
||||
private: 0x0488ADE4
|
||||
},
|
||||
pubKeyHash: 0x03,
|
||||
scriptHash: 0x7D,
|
||||
wif: 0x80
|
||||
};
|
||||
|
||||
libs.bitcoin.networks.monacoin.p2wpkh = {
|
||||
baseNetwork: "monacoin",
|
||||
messagePrefix: '\x18Monacoin Signed Message:\n',
|
||||
bech32: 'mona',
|
||||
bip32: {
|
||||
public: 0x0488b21e,
|
||||
private: 0x0488ade4
|
||||
},
|
||||
pubKeyHash: 0x32,
|
||||
scriptHash: 0x37,
|
||||
wif: 0xb0
|
||||
};
|
||||
|
||||
libs.bitcoin.networks.monacoin.p2wpkhInP2sh = {
|
||||
baseNetwork: "monacoin",
|
||||
messagePrefix: '\x18Monacoin Signed Message:\n',
|
||||
bech32: 'mona',
|
||||
bip32: {
|
||||
public: 0x0488b21e,
|
||||
private: 0x0488ade4
|
||||
},
|
||||
pubKeyHash: 0x32,
|
||||
scriptHash: 0x37,
|
||||
wif: 0xb0
|
||||
};
|
||||
|
||||
libs.bitcoin.networks.syscoin.p2wpkh = {
|
||||
baseNetwork: "syscoin",
|
||||
messagePrefix: '\x18Syscoin Signed Message:\n',
|
||||
bech32: 'sys',
|
||||
bip32: {
|
||||
public: 0x04b24746,
|
||||
private: 0x04b2430c
|
||||
},
|
||||
pubKeyHash: 0x3f,
|
||||
scriptHash: 0x05,
|
||||
wif: 0x80
|
||||
};
|
||||
|
||||
libs.bitcoin.networks.syscoin.p2wpkhInP2sh = {
|
||||
baseNetwork: "syscoin",
|
||||
messagePrefix: '\x18Syscoin Signed Message:\n',
|
||||
bech32: 'sys',
|
||||
bip32: {
|
||||
public: 0x049d7cb2,
|
||||
private: 0x049d7878
|
||||
},
|
||||
pubKeyHash: 0x3f,
|
||||
scriptHash: 0x05,
|
||||
wif: 0x80
|
||||
};
|
||||
|
||||
libs.bitcoin.networks.viacoin.p2wpkh = {
|
||||
baseNetwork: "viacoin",
|
||||
messagePrefix: '\x18Viacoin Signed Message:\n',
|
||||
bech32: 'viacoin',
|
||||
bip32: {
|
||||
public: 0x0488b21e,
|
||||
private: 0x0488ade4
|
||||
},
|
||||
pubKeyHash: 0x47,
|
||||
scriptHash: 0x21,
|
||||
wif: 0xc7
|
||||
};
|
||||
|
||||
libs.bitcoin.networks.viacoin.p2wpkhInP2sh = {
|
||||
baseNetwork: "viacoin",
|
||||
messagePrefix: '\x18Viacoin Signed Message:\n',
|
||||
bech32: 'viacoin',
|
||||
bip32: {
|
||||
public: 0x0488b21e,
|
||||
private: 0x0488ade4
|
||||
},
|
||||
pubKeyHash: 0x47,
|
||||
scriptHash: 0x21,
|
||||
wif: 0xc7
|
||||
};
|
||||
|
||||
libs.bitcoin.networks.dogecointestnet.p2wpkh = {
|
||||
baseNetwork: "dogecointestnet",
|
||||
messagePrefix: '\x19Dogecoin Signed Message:\n',
|
||||
bech32: 'dogecointestnet',
|
||||
bip32: {
|
||||
public: 0x043587cf,
|
||||
private: 0x04358394
|
||||
},
|
||||
pubKeyHash: 0x71,
|
||||
scriptHash: 0xc4,
|
||||
wif: 0xf1
|
||||
};
|
||||
|
||||
libs.bitcoin.networks.dogecointestnet.p2wpkhInP2sh = {
|
||||
baseNetwork: "dogecointestnet",
|
||||
messagePrefix: '\x19Dogecoin Signed Message:\n',
|
||||
bech32: 'dogecointestnet',
|
||||
bip32: {
|
||||
public: 0x043587cf,
|
||||
private: 0x04358394
|
||||
},
|
||||
pubKeyHash: 0x71,
|
||||
scriptHash: 0xc4,
|
||||
wif: 0xf1
|
||||
};
|
||||
|
||||
libs.bitcoin.networks.dogecointestnet.p2wpkh = {
|
||||
baseNetwork: "dogecointestnet",
|
||||
messagePrefix: '\x19Dogecoin Signed Message:\n',
|
||||
bech32: 'dogecointestnet',
|
||||
bip32: {
|
||||
public: 0x043587cf,
|
||||
private: 0x04358394
|
||||
},
|
||||
pubKeyHash: 0x71,
|
||||
scriptHash: 0xc4,
|
||||
wif: 0xf1
|
||||
};
|
||||
|
||||
libs.bitcoin.networks.dogecointestnet.p2wpkhInP2sh = {
|
||||
baseNetwork: "dogecointestnet",
|
||||
messagePrefix: '\x19Dogecoin Signed Message:\n',
|
||||
bech32: 'dogecointestnet',
|
||||
bip32: {
|
||||
public: 0x043587cf,
|
||||
private: 0x04358394
|
||||
},
|
||||
pubKeyHash: 0x71,
|
||||
scriptHash: 0xc4,
|
||||
wif: 0xf1
|
||||
};
|
||||
|
||||
libs.bitcoin.networks.litecointestnet.p2wpkh = {
|
||||
baseNetwork: "litecointestnet",
|
||||
messagePrefix: '\x18Litecoin Signed Message:\n',
|
||||
bech32: 'litecointestnet',
|
||||
bip32: {
|
||||
public: 0x043587cf,
|
||||
private: 0x04358394
|
||||
},
|
||||
pubKeyHash: 0x6f,
|
||||
scriptHash: 0xc4,
|
||||
wif: 0xef
|
||||
};
|
||||
|
||||
libs.bitcoin.networks.litecointestnet.p2wpkhInP2sh = {
|
||||
baseNetwork: "litecointestnet",
|
||||
messagePrefix: '\x18Litecoin Signed Message:\n',
|
||||
bech32: 'litecointestnet',
|
||||
bip32: {
|
||||
public: 0x043587cf,
|
||||
private: 0x04358394
|
||||
},
|
||||
pubKeyHash: 0x6f,
|
||||
scriptHash: 0xc4,
|
||||
wif: 0xef
|
||||
};
|
||||
|
||||
libs.bitcoin.networks.groestlcoin.p2wpkh = {
|
||||
baseNetwork: "groestlcoin",
|
||||
messagePrefix: '\x19GroestlCoin Signed Message:\n',
|
||||
bech32: 'grs',
|
||||
bip32: {
|
||||
public: 0x04b24746,
|
||||
private: 0x04b2430c
|
||||
},
|
||||
pubKeyHash: 0x24,
|
||||
scriptHash: 0x05,
|
||||
wif: 0x80,
|
||||
};
|
||||
|
||||
libs.bitcoin.networks.groestlcointestnet.p2wpkh = {
|
||||
baseNetwork: "groestlcointestnet",
|
||||
messagePrefix: '\x19GroestlCoin Signed Message:\n',
|
||||
bech32: 'tgrs',
|
||||
bip32: {
|
||||
public: 0x045f1cf6,
|
||||
private: 0x045f18bc
|
||||
},
|
||||
pubKeyHash: 0x6f,
|
||||
scriptHash: 0xc4,
|
||||
wif: 0xef
|
||||
};
|
||||
|
||||
libs.bitcoin.networks.groestlcoin.p2wpkhInP2sh = {
|
||||
baseNetwork: "groestlcoin",
|
||||
messagePrefix: '\x19GroestlCoin Signed Message:\n',
|
||||
bech32: 'grs',
|
||||
bip32: {
|
||||
public: 0x049d7cb2,
|
||||
private: 0x049d7878
|
||||
},
|
||||
pubKeyHash: 0x24,
|
||||
scriptHash: 0x05,
|
||||
wif: 0x80,
|
||||
};
|
||||
|
||||
libs.bitcoin.networks.groestlcointestnet.p2wpkhInP2sh = {
|
||||
baseNetwork: "groestlcointestnet",
|
||||
messagePrefix: '\x19GroestlCoin Signed Message:\n',
|
||||
bech32: 'tgrs',
|
||||
bip32: {
|
||||
public: 0x044a5262,
|
||||
private: 0x044a4e28
|
||||
},
|
||||
pubKeyHash: 0x6f,
|
||||
scriptHash: 0xc4,
|
||||
wif: 0xef
|
||||
};
|
||||
|
||||
libs.bitcoin.networks.deeponion.p2wpkh = {
|
||||
baseNetwork: "deeponion",
|
||||
messagePrefix: '\x18DeepOnion Signed Message:\n',
|
||||
bech32: 'dpn',
|
||||
bip32: {
|
||||
public: 0x0488b21e,
|
||||
private: 0x0488ade4
|
||||
},
|
||||
pubKeyHash: 0x1f,
|
||||
scriptHash: 0x4e,
|
||||
wif: 0x9f
|
||||
};
|
||||
|
||||
libs.bitcoin.networks.deeponion.p2wpkhInP2sh = {
|
||||
baseNetwork: "deeponion",
|
||||
messagePrefix: '\x18DeepOnion Signed Message:\n',
|
||||
bech32: 'dpn',
|
||||
bip32: {
|
||||
public: 0x0488b21e,
|
||||
private: 0x0488ade4
|
||||
},
|
||||
pubKeyHash: 0x1f,
|
||||
scriptHash: 0x4e,
|
||||
wif: 0x9f
|
||||
};
|
||||
|
||||
libs.bitcoin.networks.sugarchain.p2wpkh = {
|
||||
baseNetwork: "sugarchain",
|
||||
messagePrefix: '\x1DSugarchain Signed Message:\n',
|
||||
bech32: 'sugar',
|
||||
bip32: {
|
||||
public: 0x04b24746,
|
||||
private: 0x04b2430c
|
||||
},
|
||||
pubKeyHash: 0x3f,
|
||||
scriptHash: 0x7d,
|
||||
wif: 0x80
|
||||
};
|
||||
|
||||
libs.bitcoin.networks.sugarchain.p2wpkhInP2sh = {
|
||||
baseNetwork: "sugarchain",
|
||||
messagePrefix: '\x1DSugarchain Signed Message:\n',
|
||||
bech32: 'sugar',
|
||||
bip32: {
|
||||
public: 0x049d7cb2,
|
||||
private: 0x049d7878
|
||||
},
|
||||
pubKeyHash: 0x3f,
|
||||
scriptHash: 0x7d,
|
||||
wif: 0x80
|
||||
};
|
||||
|
||||
libs.bitcoin.networks.sugarchaintestnet.p2wpkh = {
|
||||
baseNetwork: "sugarchaintestnet",
|
||||
messagePrefix: '\x18Sugarchain Signed Message:\n',
|
||||
bech32: 'tugar',
|
||||
bip32: {
|
||||
public: 0x045f1cf6,
|
||||
private: 0x045f18bc
|
||||
},
|
||||
pubKeyHash: 0x42,
|
||||
scriptHash: 0x80,
|
||||
wif: 0xef
|
||||
};
|
||||
|
||||
libs.bitcoin.networks.sugarchaintestnet.p2wpkhInP2sh = {
|
||||
baseNetwork: "sugarchaintestnet",
|
||||
messagePrefix: '\x18Sugarchain Signed Message:\n',
|
||||
bech32: 'tugar',
|
||||
bip32: {
|
||||
public: 0x044a5262,
|
||||
private: 0x044a4e28
|
||||
},
|
||||
pubKeyHash: 0x42,
|
||||
scriptHash: 0x80,
|
||||
wif: 0xef
|
||||
};
|
||||
|
||||
})();
|
||||
@@ -26,13 +26,13 @@ var sjcl = {
|
||||
|
||||
/** @namespace Key exchange functions. Right now only SRP is implemented. */
|
||||
keyexchange: {},
|
||||
|
||||
|
||||
/** @namespace Block cipher modes of operation. */
|
||||
mode: {},
|
||||
|
||||
/** @namespace Miscellaneous. HMAC and PBKDF2. */
|
||||
misc: {},
|
||||
|
||||
|
||||
/**
|
||||
* @namespace Bit array encoders and decoders.
|
||||
*
|
||||
@@ -43,7 +43,7 @@ var sjcl = {
|
||||
* the method names are "fromBits" and "toBits".
|
||||
*/
|
||||
codec: {},
|
||||
|
||||
|
||||
/** @namespace Exceptions. */
|
||||
exception: {
|
||||
/** @constructor Ciphertext is corrupt. */
|
||||
@@ -51,13 +51,13 @@ var sjcl = {
|
||||
this.toString = function() { return "CORRUPT: "+this.message; };
|
||||
this.message = message;
|
||||
},
|
||||
|
||||
|
||||
/** @constructor Invalid parameter. */
|
||||
invalid: function(message) {
|
||||
this.toString = function() { return "INVALID: "+this.message; };
|
||||
this.message = message;
|
||||
},
|
||||
|
||||
|
||||
/** @constructor Bug or missing feature in SJCL. @constructor */
|
||||
bug: function(message) {
|
||||
this.toString = function() { return "BUG: "+this.message; };
|
||||
@@ -159,7 +159,7 @@ sjcl.bitArray = {
|
||||
if (a1.length === 0 || a2.length === 0) {
|
||||
return a1.concat(a2);
|
||||
}
|
||||
|
||||
|
||||
var last = a1[a1.length-1], shift = sjcl.bitArray.getPartial(last);
|
||||
if (shift === 32) {
|
||||
return a1.concat(a2);
|
||||
@@ -245,7 +245,7 @@ sjcl.bitArray = {
|
||||
_shiftRight: function (a, shift, carry, out) {
|
||||
var i, last2=0, shift2;
|
||||
if (out === undefined) { out = []; }
|
||||
|
||||
|
||||
for (; shift >= 32; shift -= 32) {
|
||||
out.push(carry);
|
||||
carry = 0;
|
||||
@@ -253,7 +253,7 @@ sjcl.bitArray = {
|
||||
if (shift === 0) {
|
||||
return out.concat(a);
|
||||
}
|
||||
|
||||
|
||||
for (i=0; i<a.length; i++) {
|
||||
out.push(carry | a[i]>>>shift);
|
||||
carry = a[i] << (32-shift);
|
||||
@@ -263,7 +263,7 @@ sjcl.bitArray = {
|
||||
out.push(sjcl.bitArray.partial(shift+shift2 & 31, (shift + shift2 > 32) ? carry : out.pop(),1));
|
||||
return out;
|
||||
},
|
||||
|
||||
|
||||
/** xor a block of 4 words together.
|
||||
* @private
|
||||
*/
|
||||
@@ -295,7 +295,7 @@ sjcl.bitArray = {
|
||||
* @author Mike Hamburg
|
||||
* @author Dan Boneh
|
||||
*/
|
||||
|
||||
|
||||
/** @namespace UTF-8 strings */
|
||||
sjcl.codec.utf8String = {
|
||||
/** Convert from a bitArray to a UTF-8 string. */
|
||||
@@ -310,7 +310,7 @@ sjcl.codec.utf8String = {
|
||||
}
|
||||
return decodeURIComponent(escape(out));
|
||||
},
|
||||
|
||||
|
||||
/** Convert from a UTF-8 string to a bitArray. */
|
||||
toBits: function (str) {
|
||||
str = unescape(encodeURIComponent(str));
|
||||
@@ -412,7 +412,7 @@ sjcl.hash.sha512.prototype = {
|
||||
* @constant
|
||||
*/
|
||||
blockSize: 1024,
|
||||
|
||||
|
||||
/**
|
||||
* Reset the hash state.
|
||||
* @return this
|
||||
@@ -423,7 +423,7 @@ sjcl.hash.sha512.prototype = {
|
||||
this._length = 0;
|
||||
return this;
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* Input several words to the hash.
|
||||
* @param {bitArray|String} data the data to hash.
|
||||
@@ -441,7 +441,7 @@ sjcl.hash.sha512.prototype = {
|
||||
}
|
||||
return this;
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* Complete hashing and output the hash value.
|
||||
* @return {bitArray} The hash value, an array of 16 big-endian words.
|
||||
@@ -736,12 +736,12 @@ sjcl.misc.hmac = function (key, Hash) {
|
||||
if (key.length > bs) {
|
||||
key = Hash.hash(key);
|
||||
}
|
||||
|
||||
|
||||
for (i=0; i<bs; i++) {
|
||||
exKey[0][i] = key[i]^0x36363636;
|
||||
exKey[1][i] = key[i]^0x5C5C5C5C;
|
||||
}
|
||||
|
||||
|
||||
this._baseHash[0].update(exKey[0]);
|
||||
this._baseHash[1].update(exKey[1]);
|
||||
this._resultHash = new Hash(this._baseHash[0]);
|
||||
@@ -804,34 +804,34 @@ sjcl.misc.hmac.prototype.digest = function () {
|
||||
*/
|
||||
sjcl.misc.pbkdf2 = function (password, salt, count, length, Prff) {
|
||||
count = count || 1000;
|
||||
|
||||
|
||||
if (length < 0 || count < 0) {
|
||||
throw sjcl.exception.invalid("invalid params to pbkdf2");
|
||||
}
|
||||
|
||||
|
||||
if (typeof password === "string") {
|
||||
password = sjcl.codec.utf8String.toBits(password);
|
||||
}
|
||||
|
||||
|
||||
if (typeof salt === "string") {
|
||||
salt = sjcl.codec.utf8String.toBits(salt);
|
||||
}
|
||||
|
||||
|
||||
Prff = Prff || sjcl.misc.hmac;
|
||||
|
||||
|
||||
var prf = new Prff(password),
|
||||
u, ui, i, j, k, out = [], b = sjcl.bitArray;
|
||||
|
||||
for (k = 1; 32 * out.length < (length || 1); k++) {
|
||||
u = ui = prf.encrypt(b.concat(salt,[k]));
|
||||
|
||||
|
||||
for (i=1; i<count; i++) {
|
||||
ui = prf.encrypt(ui);
|
||||
for (j=0; j<ui.length; j++) {
|
||||
u[j] ^= ui[j];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
out = out.concat(u);
|
||||
}
|
||||
|
||||
@@ -890,7 +890,7 @@ sjcl.hash.sha256.prototype = {
|
||||
* @constant
|
||||
*/
|
||||
blockSize: 512,
|
||||
|
||||
|
||||
/**
|
||||
* Reset the hash state.
|
||||
* @return this
|
||||
@@ -901,7 +901,7 @@ sjcl.hash.sha256.prototype = {
|
||||
this._length = 0;
|
||||
return this;
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* Input several words to the hash.
|
||||
* @param {bitArray|String} data the data to hash.
|
||||
@@ -919,7 +919,7 @@ sjcl.hash.sha256.prototype = {
|
||||
}
|
||||
return this;
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* Complete hashing and output the hash value.
|
||||
* @return {bitArray} The hash value, an array of 8 big-endian words.
|
||||
@@ -929,12 +929,12 @@ sjcl.hash.sha256.prototype = {
|
||||
|
||||
// Round out and push the buffer
|
||||
b = sjcl.bitArray.concat(b, [sjcl.bitArray.partial(1,1)]);
|
||||
|
||||
|
||||
// Round out the buffer to a multiple of 16 words, less the 2 length words.
|
||||
for (i = b.length + 2; i & 15; i++) {
|
||||
b.push(0);
|
||||
}
|
||||
|
||||
|
||||
// append the length
|
||||
b.push(Math.floor(this._length / 0x100000000));
|
||||
b.push(this._length | 0);
|
||||
@@ -955,7 +955,7 @@ sjcl.hash.sha256.prototype = {
|
||||
/*
|
||||
_init:[0x6a09e667,0xbb67ae85,0x3c6ef372,0xa54ff53a,0x510e527f,0x9b05688c,0x1f83d9ab,0x5be0cd19],
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* The SHA-256 hash key, to be precomputed.
|
||||
* @private
|
||||
@@ -990,7 +990,7 @@ sjcl.hash.sha256.prototype = {
|
||||
continue outer;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (i<8) {
|
||||
this._init[i] = frac(Math.pow(prime, 1/2));
|
||||
}
|
||||
@@ -998,13 +998,13 @@ sjcl.hash.sha256.prototype = {
|
||||
i++;
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* Perform one cycle of SHA-256.
|
||||
* @param {bitArray} words one block of words.
|
||||
* @private
|
||||
*/
|
||||
_block:function (words) {
|
||||
_block:function (words) {
|
||||
var i, tmp, a, b,
|
||||
w = words.slice(0),
|
||||
h = this._h,
|
||||
@@ -1032,13 +1032,13 @@ sjcl.hash.sha256.prototype = {
|
||||
} else {
|
||||
a = w[(i+1 ) & 15];
|
||||
b = w[(i+14) & 15];
|
||||
tmp = w[i&15] = ((a>>>7 ^ a>>>18 ^ a>>>3 ^ a<<25 ^ a<<14) +
|
||||
tmp = w[i&15] = ((a>>>7 ^ a>>>18 ^ a>>>3 ^ a<<25 ^ a<<14) +
|
||||
(b>>>17 ^ b>>>19 ^ b>>>10 ^ b<<15 ^ b<<13) +
|
||||
w[i&15] + w[(i+9) & 15]) | 0;
|
||||
}
|
||||
|
||||
|
||||
tmp = (tmp + h7 + (h4>>>6 ^ h4>>>11 ^ h4>>>25 ^ h4<<26 ^ h4<<21 ^ h4<<7) + (h6 ^ h4&(h5^h6)) + k[i]); // | 0;
|
||||
|
||||
|
||||
// shift register
|
||||
h7 = h6; h6 = h5; h5 = h4;
|
||||
h4 = h3 + tmp | 0;
|
||||
|
||||
@@ -1,153 +0,0 @@
|
||||
// An extremely basic translation library
|
||||
//
|
||||
// Example usage:
|
||||
//
|
||||
// Set some html to be translated. Do this using the 'data-translate' attribute:
|
||||
//
|
||||
// <div data-translate>Test</div>
|
||||
// <div data-translate-html><em>keep em tag</em></div>
|
||||
// <input data-translate-placeholder placeholder="Example placeholder">
|
||||
// <span data-translate-title title="Example title"></span>
|
||||
//
|
||||
// Obtain all the phrases to be translated via js debug console:
|
||||
//
|
||||
// Translate.phrasesAsJson();
|
||||
//
|
||||
// Use that template to translate the phrases into another language.
|
||||
// Leave the key the same. Change the value to the new language.
|
||||
//
|
||||
// Create a js file to load the new phrases. In this example for Spanish,
|
||||
// es.js will contain the following code:
|
||||
//
|
||||
// Translate.loadForeignPhrases("es", {
|
||||
// "Test": "Test in Spanish",
|
||||
// "<em>keep em tag</em>": "<em>keep em tag in Spanish</em>",
|
||||
// "Example placeholder": "Example placeholder in Spanish"
|
||||
// "Example title": "Example title in Spanish"
|
||||
// });
|
||||
//
|
||||
// In your UI put a listener for clicking on the Spanish button:
|
||||
//
|
||||
// mySpanishButton.addEventListener("click", function() {
|
||||
// Translate.setLanguage("es");
|
||||
// });
|
||||
// myEnglishButton.addEventListener("click", function() {
|
||||
// Translate.setLanguage("en");
|
||||
// });
|
||||
|
||||
Translate = new (function() {
|
||||
|
||||
var defaultLanguage = "en";
|
||||
|
||||
var allPhrases = {};
|
||||
allPhrases[defaultLanguage] = {};
|
||||
|
||||
// Node types
|
||||
|
||||
var text = {
|
||||
selector: "[data-translate]",
|
||||
getKey: function() {
|
||||
return this.textContent.trim().replace(/\s+/g, " ");
|
||||
},
|
||||
setPhrase: function(p) {
|
||||
this.textContent = p;
|
||||
},
|
||||
}
|
||||
|
||||
var html = {
|
||||
selector: "[data-translate-html]",
|
||||
getKey: function() {
|
||||
return this.innerHTML.trim().replace(/\s+/g, " ");
|
||||
},
|
||||
setPhrase: function(p) {
|
||||
this.innerHTML = p;
|
||||
},
|
||||
}
|
||||
|
||||
var placeholder = {
|
||||
selector: "[data-translate-placeholder]",
|
||||
getKey: function() {
|
||||
return this.getAttribute("placeholder").trim().replace(/\s+/g, " ");
|
||||
},
|
||||
setPhrase: function(p) {
|
||||
this.setAttribute("placeholder", p);
|
||||
},
|
||||
}
|
||||
|
||||
var title = {
|
||||
selector: "[data-translate-title]",
|
||||
getKey: function() {
|
||||
return this.getAttribute("title").trim().replace(/\s+/g, " ");
|
||||
},
|
||||
setPhrase: function(p) {
|
||||
this.setAttribute("title", p);
|
||||
},
|
||||
}
|
||||
|
||||
// Get elements to be translated
|
||||
var allEls = getEls(text)
|
||||
.concat(getEls(html))
|
||||
.concat(getEls(placeholder))
|
||||
.concat(getEls(title));
|
||||
|
||||
// Provides access to phrases from a non-default language.
|
||||
// See phrases_en.js for example usage.
|
||||
this.loadForeignPhrases = function(language, phrases) {
|
||||
allPhrases[language] = phrases;
|
||||
}
|
||||
|
||||
// Displays a different language, eg "en" or "fr"
|
||||
this.setLanguage = function(language) {
|
||||
for (var i=0; i<allEls.length; i++) {
|
||||
var el = allEls[i];
|
||||
var key = el.key;
|
||||
if (!(language in allPhrases)) {
|
||||
console.log(language + " not in allPhrases");
|
||||
return;
|
||||
}
|
||||
if (!(key in allPhrases[language])) {
|
||||
console.log(language + " does not contain phrase: " + key);
|
||||
return;
|
||||
}
|
||||
var phrase = allPhrases[language][key];
|
||||
el.setPhrase(phrase);
|
||||
}
|
||||
}
|
||||
|
||||
// Converts the phrases to a key-pair json file.
|
||||
// This is a good way to export phrases for use in translation tools.
|
||||
this.phrasesAsJson = function(language) {
|
||||
var keys = [];
|
||||
for (var i=0; i<allEls.length; i++) {
|
||||
var el = allEls[i];
|
||||
var key = el.key;
|
||||
keys.push(key);
|
||||
}
|
||||
keys.sort();
|
||||
var output = {};
|
||||
for (var i=0; i<keys.length; i++) {
|
||||
var key = keys[i];
|
||||
var translated = "";
|
||||
if (language in allPhrases && key in allPhrases[language]) {
|
||||
translated = allPhrases[language][key];
|
||||
}
|
||||
output[key] = translated;
|
||||
}
|
||||
return JSON.stringify(output, null, 2);
|
||||
}
|
||||
|
||||
function getEls(nodeType) {
|
||||
var nodes = document.querySelectorAll(nodeType.selector);
|
||||
var els = [];
|
||||
for (var i=0; i<nodes.length; i++) {
|
||||
var node = nodes[i];
|
||||
node.getKey = nodeType.getKey;
|
||||
node.setPhrase = nodeType.setPhrase;
|
||||
node.key = node.getKey();
|
||||
allPhrases[defaultLanguage][node.key] = node.key;
|
||||
els.push(node);
|
||||
}
|
||||
return els;
|
||||
}
|
||||
|
||||
})();
|
||||
442
src/js/unorm.js
442
src/js/unorm.js
File diff suppressed because one or more lines are too long
14
src/js/wordlist_czech.js
Normal file
14
src/js/wordlist_czech.js
Normal file
File diff suppressed because one or more lines are too long
2051
src/js/wordlist_korean.js
Normal file
2051
src/js/wordlist_korean.js
Normal file
File diff suppressed because it is too large
Load Diff
197
src/js/wordlist_portuguese.js
Normal file
197
src/js/wordlist_portuguese.js
Normal file
@@ -0,0 +1,197 @@
|
||||
WORDLISTS = typeof
|
||||
WORDLISTS == "undefined" ? {}: WORDLISTS;
|
||||
WORDLISTS["portuguese"] = [
|
||||
"abacate", "abaixo", "abalar", "abater", "abduzir", "abelha", "aberto", "abismo", "abotoar", "abranger", "abreviar",
|
||||
"abrigar", "abrupto", "absinto", "absoluto", "absurdo", "abutre", "acabado", "acalmar", "acampar", "acanhar",
|
||||
"acaso", "aceitar", "acelerar", "acenar", "acervo", "acessar", "acetona", "achatar", "acidez", "acima", "acionado",
|
||||
"acirrar", "aclamar", "aclive", "acolhida", "acomodar", "acoplar", "acordar", "acumular", "acusador", "adaptar",
|
||||
"adega", "adentro", "adepto", "adequar", "aderente", "adesivo", "adeus", "adiante", "aditivo", "adjetivo",
|
||||
"adjunto", "admirar", "adorar", "adquirir", "adubo", "adverso", "advogado", "aeronave", "afastar", "aferir",
|
||||
"afetivo", "afinador", "afivelar", "aflito", "afluente", "afrontar", "agachar", "agarrar", "agasalho", "agenciar",
|
||||
"agilizar", "agiota", "agitado", "agora", "agradar", "agreste", "agrupar", "aguardar", "agulha", "ajoelhar",
|
||||
"ajudar", "ajustar", "alameda", "alarme", "alastrar", "alavanca", "albergue", "albino", "alcatra", "aldeia",
|
||||
"alecrim", "alegria", "alertar", "alface", "alfinete", "algum", "alheio", "aliar", "alicate", "alienar", "alinhar",
|
||||
"aliviar", "almofada", "alocar", "alpiste", "alterar", "altitude", "alucinar", "alugar", "aluno", "alusivo", "alvo",
|
||||
"amaciar", "amador", "amarelo", "amassar", "ambas", "ambiente", "ameixa", "amenizar", "amido", "amistoso",
|
||||
"amizade", "amolador", "amontoar", "amoroso", "amostra", "amparar", "ampliar", "ampola", "anagrama", "analisar",
|
||||
"anarquia", "anatomia", "andaime", "anel", "anexo", "angular", "animar", "anjo", "anomalia", "anotado", "ansioso",
|
||||
"anterior", "anuidade", "anunciar", "anzol", "apagador", "apalpar", "apanhado", "apego", "apelido", "apertada",
|
||||
"apesar", "apetite", "apito", "aplauso", "aplicada", "apoio", "apontar", "aposta", "aprendiz", "aprovar", "aquecer",
|
||||
"arame", "aranha", "arara", "arcada", "ardente", "areia", "arejar", "arenito", "aresta", "argiloso", "argola",
|
||||
"arma", "arquivo", "arraial", "arrebate", "arriscar", "arroba", "arrumar", "arsenal", "arterial", "artigo",
|
||||
"arvoredo", "asfaltar", "asilado", "aspirar", "assador", "assinar", "assoalho", "assunto", "astral", "atacado",
|
||||
"atadura", "atalho", "atarefar", "atear", "atender", "aterro", "ateu", "atingir", "atirador", "ativo", "atoleiro",
|
||||
"atracar", "atrevido", "atriz", "atual", "atum", "auditor", "aumentar", "aura", "aurora", "autismo", "autoria",
|
||||
"autuar", "avaliar", "avante", "avaria", "avental", "avesso", "aviador", "avisar", "avulso", "axila", "azarar",
|
||||
"azedo", "azeite", "azulejo", "babar", "babosa", "bacalhau", "bacharel", "bacia", "bagagem", "baiano", "bailar",
|
||||
"baioneta", "bairro", "baixista", "bajular", "baleia", "baliza", "balsa", "banal", "bandeira", "banho", "banir",
|
||||
"banquete", "barato", "barbado", "baronesa", "barraca", "barulho", "baseado", "bastante", "batata", "batedor",
|
||||
"batida", "batom", "batucar", "baunilha", "beber", "beijo", "beirada", "beisebol", "beldade", "beleza", "belga",
|
||||
"beliscar", "bendito", "bengala", "benzer", "berimbau", "berlinda", "berro", "besouro", "bexiga", "bezerro", "bico",
|
||||
"bicudo", "bienal", "bifocal", "bifurcar", "bigorna", "bilhete", "bimestre", "bimotor", "biologia", "biombo",
|
||||
"biosfera", "bipolar", "birrento", "biscoito", "bisneto", "bispo", "bissexto", "bitola", "bizarro", "blindado",
|
||||
"bloco", "bloquear", "boato", "bobagem", "bocado", "bocejo", "bochecha", "boicotar", "bolada", "boletim", "bolha",
|
||||
"bolo", "bombeiro", "bonde", "boneco", "bonita", "borbulha", "borda", "boreal", "borracha", "bovino", "boxeador",
|
||||
"branco", "brasa", "braveza", "breu", "briga", "brilho", "brincar", "broa", "brochura", "bronzear", "broto",
|
||||
"bruxo", "bucha", "budismo", "bufar", "bule", "buraco", "busca", "busto", "buzina", "cabana", "cabelo", "cabide",
|
||||
"cabo", "cabrito", "cacau", "cacetada", "cachorro", "cacique", "cadastro", "cadeado", "cafezal", "caiaque",
|
||||
"caipira", "caixote", "cajado", "caju", "calafrio", "calcular", "caldeira", "calibrar", "calmante", "calota",
|
||||
"camada", "cambista", "camisa", "camomila", "campanha", "camuflar", "canavial", "cancelar", "caneta", "canguru",
|
||||
"canhoto", "canivete", "canoa", "cansado", "cantar", "canudo", "capacho", "capela", "capinar", "capotar",
|
||||
"capricho", "captador", "capuz", "caracol", "carbono", "cardeal", "careca", "carimbar", "carneiro", "carpete",
|
||||
"carreira", "cartaz", "carvalho", "casaco", "casca", "casebre", "castelo", "casulo", "catarata", "cativar", "caule",
|
||||
"causador", "cautelar", "cavalo", "caverna", "cebola", "cedilha", "cegonha", "celebrar", "celular", "cenoura",
|
||||
"censo", "centeio", "cercar", "cerrado", "certeiro", "cerveja", "cetim", "cevada", "chacota", "chaleira", "chamado",
|
||||
"chapada", "charme", "chatice", "chave", "chefe", "chegada", "cheiro", "cheque", "chicote", "chifre", "chinelo",
|
||||
"chocalho", "chover", "chumbo", "chutar", "chuva", "cicatriz", "ciclone", "cidade", "cidreira", "ciente", "cigana",
|
||||
"cimento", "cinto", "cinza", "ciranda", "circuito", "cirurgia", "citar", "clareza", "clero", "clicar", "clone",
|
||||
"clube", "coado", "coagir", "cobaia", "cobertor", "cobrar", "cocada", "coelho", "coentro", "coeso", "cogumelo",
|
||||
"coibir", "coifa", "coiote", "colar", "coleira", "colher", "colidir", "colmeia", "colono", "coluna", "comando",
|
||||
"combinar", "comentar", "comitiva", "comover", "complexo", "comum", "concha", "condor", "conectar", "confuso",
|
||||
"congelar", "conhecer", "conjugar", "consumir", "contrato", "convite", "cooperar", "copeiro", "copiador", "copo",
|
||||
"coquetel", "coragem", "cordial", "corneta", "coronha", "corporal", "correio", "cortejo", "coruja", "corvo",
|
||||
"cosseno", "costela", "cotonete", "couro", "couve", "covil", "cozinha", "cratera", "cravo", "creche", "credor",
|
||||
"creme", "crer", "crespo", "criada", "criminal", "crioulo", "crise", "criticar", "crosta", "crua", "cruzeiro",
|
||||
"cubano", "cueca", "cuidado", "cujo", "culatra", "culminar", "culpar", "cultura", "cumprir", "cunhado", "cupido",
|
||||
"curativo", "curral", "cursar", "curto", "cuspir", "custear", "cutelo", "damasco", "datar", "debater", "debitar",
|
||||
"deboche", "debulhar", "decalque", "decimal", "declive", "decote", "decretar", "dedal", "dedicado", "deduzir",
|
||||
"defesa", "defumar", "degelo", "degrau", "degustar", "deitado", "deixar", "delator", "delegado", "delinear",
|
||||
"delonga", "demanda", "demitir", "demolido", "dentista", "depenado", "depilar", "depois", "depressa", "depurar",
|
||||
"deriva", "derramar", "desafio", "desbotar", "descanso", "desenho", "desfiado", "desgaste", "desigual", "deslize",
|
||||
"desmamar", "desova", "despesa", "destaque", "desviar", "detalhar", "detentor", "detonar", "detrito", "deusa",
|
||||
"dever", "devido", "devotado", "dezena", "diagrama", "dialeto", "didata", "difuso", "digitar", "dilatado",
|
||||
"diluente", "diminuir", "dinastia", "dinheiro", "diocese", "direto", "discreta", "disfarce", "disparo", "disquete",
|
||||
"dissipar", "distante", "ditador", "diurno", "diverso", "divisor", "divulgar", "dizer", "dobrador", "dolorido",
|
||||
"domador", "dominado", "donativo", "donzela", "dormente", "dorsal", "dosagem", "dourado", "doutor", "drenagem",
|
||||
"drible", "drogaria", "duelar", "duende", "dueto", "duplo", "duquesa", "durante", "duvidoso", "eclodir", "ecoar",
|
||||
"ecologia", "edificar", "edital", "educado", "efeito", "efetivar", "ejetar", "elaborar", "eleger", "eleitor",
|
||||
"elenco", "elevador", "eliminar", "elogiar", "embargo", "embolado", "embrulho", "embutido", "emenda", "emergir",
|
||||
"emissor", "empatia", "empenho", "empinado", "empolgar", "emprego", "empurrar", "emulador", "encaixe", "encenado",
|
||||
"enchente", "encontro", "endeusar", "endossar", "enfaixar", "enfeite", "enfim", "engajado", "engenho", "englobar",
|
||||
"engomado", "engraxar", "enguia", "enjoar", "enlatar", "enquanto", "enraizar", "enrolado", "enrugar", "ensaio",
|
||||
"enseada", "ensino", "ensopado", "entanto", "enteado", "entidade", "entortar", "entrada", "entulho", "envergar",
|
||||
"enviado", "envolver", "enxame", "enxerto", "enxofre", "enxuto", "epiderme", "equipar", "ereto", "erguido",
|
||||
"errata", "erva", "ervilha", "esbanjar", "esbelto", "escama", "escola", "escrita", "escuta", "esfinge", "esfolar",
|
||||
"esfregar", "esfumado", "esgrima", "esmalte", "espanto", "espelho", "espiga", "esponja", "espreita", "espumar",
|
||||
"esquerda", "estaca", "esteira", "esticar", "estofado", "estrela", "estudo", "esvaziar", "etanol", "etiqueta",
|
||||
"euforia", "europeu", "evacuar", "evaporar", "evasivo", "eventual", "evidente", "evoluir", "exagero", "exalar",
|
||||
"examinar", "exato", "exausto", "excesso", "excitar", "exclamar", "executar", "exemplo", "exibir", "exigente",
|
||||
"exonerar", "expandir", "expelir", "expirar", "explanar", "exposto", "expresso", "expulsar", "externo", "extinto",
|
||||
"extrato", "fabricar", "fabuloso", "faceta", "facial", "fada", "fadiga", "faixa", "falar", "falta", "familiar",
|
||||
"fandango", "fanfarra", "fantoche", "fardado", "farelo", "farinha", "farofa", "farpa", "fartura", "fatia", "fator",
|
||||
"favorita", "faxina", "fazenda", "fechado", "feijoada", "feirante", "felino", "feminino", "fenda", "feno", "fera",
|
||||
"feriado", "ferrugem", "ferver", "festejar", "fetal", "feudal", "fiapo", "fibrose", "ficar", "ficheiro", "figurado",
|
||||
"fileira", "filho", "filme", "filtrar", "firmeza", "fisgada", "fissura", "fita", "fivela", "fixador", "fixo",
|
||||
"flacidez", "flamingo", "flanela", "flechada", "flora", "flutuar", "fluxo", "focal", "focinho", "fofocar", "fogo",
|
||||
"foguete", "foice", "folgado", "folheto", "forjar", "formiga", "forno", "forte", "fosco", "fossa", "fragata",
|
||||
"fralda", "frango", "frasco", "fraterno", "freira", "frente", "fretar", "frieza", "friso", "fritura", "fronha",
|
||||
"frustrar", "fruteira", "fugir", "fulano", "fuligem", "fundar", "fungo", "funil", "furador", "furioso", "futebol",
|
||||
"gabarito", "gabinete", "gado", "gaiato", "gaiola", "gaivota", "galega", "galho", "galinha", "galocha", "ganhar",
|
||||
"garagem", "garfo", "gargalo", "garimpo", "garoupa", "garrafa", "gasoduto", "gasto", "gata", "gatilho", "gaveta",
|
||||
"gazela", "gelado", "geleia", "gelo", "gemada", "gemer", "gemido", "generoso", "gengiva", "genial", "genoma",
|
||||
"genro", "geologia", "gerador", "germinar", "gesso", "gestor", "ginasta", "gincana", "gingado", "girafa", "girino",
|
||||
"glacial", "glicose", "global", "glorioso", "goela", "goiaba", "golfe", "golpear", "gordura", "gorjeta", "gorro",
|
||||
"gostoso", "goteira", "governar", "gracejo", "gradual", "grafite", "gralha", "grampo", "granada", "gratuito",
|
||||
"graveto", "graxa", "grego", "grelhar", "greve", "grilo", "grisalho", "gritaria", "grosso", "grotesco", "grudado",
|
||||
"grunhido", "gruta", "guache", "guarani", "guaxinim", "guerrear", "guiar", "guincho", "guisado", "gula", "guloso",
|
||||
"guru", "habitar", "harmonia", "haste", "haver", "hectare", "herdar", "heresia", "hesitar", "hiato", "hibernar",
|
||||
"hidratar", "hiena", "hino", "hipismo", "hipnose", "hipoteca", "hoje", "holofote", "homem", "honesto", "honrado",
|
||||
"hormonal", "hospedar", "humorado", "iate", "ideia", "idoso", "ignorado", "igreja", "iguana", "ileso", "ilha",
|
||||
"iludido", "iluminar", "ilustrar", "imagem", "imediato", "imenso", "imersivo", "iminente", "imitador", "imortal",
|
||||
"impacto", "impedir", "implante", "impor", "imprensa", "impune", "imunizar", "inalador", "inapto", "inativo",
|
||||
"incenso", "inchar", "incidir", "incluir", "incolor", "indeciso", "indireto", "indutor", "ineficaz", "inerente",
|
||||
"infantil", "infestar", "infinito", "inflamar", "informal", "infrator", "ingerir", "inibido", "inicial", "inimigo",
|
||||
"injetar", "inocente", "inodoro", "inovador", "inox", "inquieto", "inscrito", "inseto", "insistir", "inspetor",
|
||||
"instalar", "insulto", "intacto", "integral", "intimar", "intocado", "intriga", "invasor", "inverno", "invicto",
|
||||
"invocar", "iogurte", "iraniano", "ironizar", "irreal", "irritado", "isca", "isento", "isolado", "isqueiro",
|
||||
"italiano", "janeiro", "jangada", "janta", "jararaca", "jardim", "jarro", "jasmim", "jato", "javali", "jazida",
|
||||
"jejum", "joaninha", "joelhada", "jogador", "joia", "jornal", "jorrar", "jovem", "juba", "judeu", "judoca", "juiz",
|
||||
"julgador", "julho", "jurado", "jurista", "juro", "justa", "labareda", "laboral", "lacre", "lactante", "ladrilho",
|
||||
"lagarta", "lagoa", "laje", "lamber", "lamentar", "laminar", "lampejo", "lanche", "lapidar", "lapso", "laranja",
|
||||
"lareira", "largura", "lasanha", "lastro", "lateral", "latido", "lavanda", "lavoura", "lavrador", "laxante",
|
||||
"lazer", "lealdade", "lebre", "legado", "legendar", "legista", "leigo", "leiloar", "leitura", "lembrete", "leme",
|
||||
"lenhador", "lentilha", "leoa", "lesma", "leste", "letivo", "letreiro", "levar", "leveza", "levitar", "liberal",
|
||||
"libido", "liderar", "ligar", "ligeiro", "limitar", "limoeiro", "limpador", "linda", "linear", "linhagem",
|
||||
"liquidez", "listagem", "lisura", "litoral", "livro", "lixa", "lixeira", "locador", "locutor", "lojista", "lombo",
|
||||
"lona", "longe", "lontra", "lorde", "lotado", "loteria", "loucura", "lousa", "louvar", "luar", "lucidez", "lucro",
|
||||
"luneta", "lustre", "lutador", "luva", "macaco", "macete", "machado", "macio", "madeira", "madrinha", "magnata",
|
||||
"magreza", "maior", "mais", "malandro", "malha", "malote", "maluco", "mamilo", "mamoeiro", "mamute", "manada",
|
||||
"mancha", "mandato", "manequim", "manhoso", "manivela", "manobrar", "mansa", "manter", "manusear", "mapeado",
|
||||
"maquinar", "marcador", "maresia", "marfim", "margem", "marinho", "marmita", "maroto", "marquise", "marreco",
|
||||
"martelo", "marujo", "mascote", "masmorra", "massagem", "mastigar", "matagal", "materno", "matinal", "matutar",
|
||||
"maxilar", "medalha", "medida", "medusa", "megafone", "meiga", "melancia", "melhor", "membro", "memorial", "menino",
|
||||
"menos", "mensagem", "mental", "merecer", "mergulho", "mesada", "mesclar", "mesmo", "mesquita", "mestre", "metade",
|
||||
"meteoro", "metragem", "mexer", "mexicano", "micro", "migalha", "migrar", "milagre", "milenar", "milhar", "mimado",
|
||||
"minerar", "minhoca", "ministro", "minoria", "miolo", "mirante", "mirtilo", "misturar", "mocidade", "moderno",
|
||||
"modular", "moeda", "moer", "moinho", "moita", "moldura", "moleza", "molho", "molinete", "molusco", "montanha",
|
||||
"moqueca", "morango", "morcego", "mordomo", "morena", "mosaico", "mosquete", "mostarda", "motel", "motim", "moto",
|
||||
"motriz", "muda", "muito", "mulata", "mulher", "multar", "mundial", "munido", "muralha", "murcho", "muscular",
|
||||
"museu", "musical", "nacional", "nadador", "naja", "namoro", "narina", "narrado", "nascer", "nativa", "natureza",
|
||||
"navalha", "navegar", "navio", "neblina", "nebuloso", "negativa", "negociar", "negrito", "nervoso", "neta",
|
||||
"neural", "nevasca", "nevoeiro", "ninar", "ninho", "nitidez", "nivelar", "nobreza", "noite", "noiva", "nomear",
|
||||
"nominal", "nordeste", "nortear", "notar", "noticiar", "noturno", "novelo", "novilho", "novo", "nublado", "nudez",
|
||||
"numeral", "nupcial", "nutrir", "nuvem", "obcecado", "obedecer", "objetivo", "obrigado", "obscuro", "obstetra",
|
||||
"obter", "obturar", "ocidente", "ocioso", "ocorrer", "oculista", "ocupado", "ofegante", "ofensiva", "oferenda",
|
||||
"oficina", "ofuscado", "ogiva", "olaria", "oleoso", "olhar", "oliveira", "ombro", "omelete", "omisso", "omitir",
|
||||
"ondulado", "oneroso", "ontem", "opcional", "operador", "oponente", "oportuno", "oposto", "orar", "orbitar",
|
||||
"ordem", "ordinal", "orfanato", "orgasmo", "orgulho", "oriental", "origem", "oriundo", "orla", "ortodoxo",
|
||||
"orvalho", "oscilar", "ossada", "osso", "ostentar", "otimismo", "ousadia", "outono", "outubro", "ouvido", "ovelha",
|
||||
"ovular", "oxidar", "oxigenar", "pacato", "paciente", "pacote", "pactuar", "padaria", "padrinho", "pagar", "pagode",
|
||||
"painel", "pairar", "paisagem", "palavra", "palestra", "palheta", "palito", "palmada", "palpitar", "pancada",
|
||||
"panela", "panfleto", "panqueca", "pantanal", "papagaio", "papelada", "papiro", "parafina", "parcial", "pardal",
|
||||
"parede", "partida", "pasmo", "passado", "pastel", "patamar", "patente", "patinar", "patrono", "paulada", "pausar",
|
||||
"peculiar", "pedalar", "pedestre", "pediatra", "pedra", "pegada", "peitoral", "peixe", "pele", "pelicano", "penca",
|
||||
"pendurar", "peneira", "penhasco", "pensador", "pente", "perceber", "perfeito", "pergunta", "perito", "permitir",
|
||||
"perna", "perplexo", "persiana", "pertence", "peruca", "pescado", "pesquisa", "pessoa", "petiscar", "piada",
|
||||
"picado", "piedade", "pigmento", "pilastra", "pilhado", "pilotar", "pimenta", "pincel", "pinguim", "pinha",
|
||||
"pinote", "pintar", "pioneiro", "pipoca", "piquete", "piranha", "pires", "pirueta", "piscar", "pistola", "pitanga",
|
||||
"pivete", "planta", "plaqueta", "platina", "plebeu", "plumagem", "pluvial", "pneu", "poda", "poeira", "poetisa",
|
||||
"polegada", "policiar", "poluente", "polvilho", "pomar", "pomba", "ponderar", "pontaria", "populoso", "porta",
|
||||
"possuir", "postal", "pote", "poupar", "pouso", "povoar", "praia", "prancha", "prato", "praxe", "prece", "predador",
|
||||
"prefeito", "premiar", "prensar", "preparar", "presilha", "pretexto", "prevenir", "prezar", "primata", "princesa",
|
||||
"prisma", "privado", "processo", "produto", "profeta", "proibido", "projeto", "prometer", "propagar", "prosa",
|
||||
"protetor", "provador", "publicar", "pudim", "pular", "pulmonar", "pulseira", "punhal", "punir", "pupilo", "pureza",
|
||||
"puxador", "quadra", "quantia", "quarto", "quase", "quebrar", "queda", "queijo", "quente", "querido", "quimono",
|
||||
"quina", "quiosque", "rabanada", "rabisco", "rachar", "racionar", "radial", "raiar", "rainha", "raio", "raiva",
|
||||
"rajada", "ralado", "ramal", "ranger", "ranhura", "rapadura", "rapel", "rapidez", "raposa", "raquete", "raridade",
|
||||
"rasante", "rascunho", "rasgar", "raspador", "rasteira", "rasurar", "ratazana", "ratoeira", "realeza", "reanimar",
|
||||
"reaver", "rebaixar", "rebelde", "rebolar", "recado", "recente", "recheio", "recibo", "recordar", "recrutar",
|
||||
"recuar", "rede", "redimir", "redonda", "reduzida", "reenvio", "refinar", "refletir", "refogar", "refresco",
|
||||
"refugiar", "regalia", "regime", "regra", "reinado", "reitor", "rejeitar", "relativo", "remador", "remendo",
|
||||
"remorso", "renovado", "reparo", "repelir", "repleto", "repolho", "represa", "repudiar", "requerer", "resenha",
|
||||
"resfriar", "resgatar", "residir", "resolver", "respeito", "ressaca", "restante", "resumir", "retalho", "reter",
|
||||
"retirar", "retomada", "retratar", "revelar", "revisor", "revolta", "riacho", "rica", "rigidez", "rigoroso",
|
||||
"rimar", "ringue", "risada", "risco", "risonho", "robalo", "rochedo", "rodada", "rodeio", "rodovia", "roedor",
|
||||
"roleta", "romano", "roncar", "rosado", "roseira", "rosto", "rota", "roteiro", "rotina", "rotular", "rouco",
|
||||
"roupa", "roxo", "rubro", "rugido", "rugoso", "ruivo", "rumo", "rupestre", "russo", "sabor", "saciar", "sacola",
|
||||
"sacudir", "sadio", "safira", "saga", "sagrada", "saibro", "salada", "saleiro", "salgado", "saliva", "salpicar",
|
||||
"salsicha", "saltar", "salvador", "sambar", "samurai", "sanar", "sanfona", "sangue", "sanidade", "sapato", "sarda",
|
||||
"sargento", "sarjeta", "saturar", "saudade", "saxofone", "sazonal", "secar", "secular", "seda", "sedento",
|
||||
"sediado", "sedoso", "sedutor", "segmento", "segredo", "segundo", "seiva", "seleto", "selvagem", "semanal",
|
||||
"semente", "senador", "senhor", "sensual", "sentado", "separado", "sereia", "seringa", "serra", "servo", "setembro",
|
||||
"setor", "sigilo", "silhueta", "silicone", "simetria", "simpatia", "simular", "sinal", "sincero", "singular",
|
||||
"sinopse", "sintonia", "sirene", "siri", "situado", "soberano", "sobra", "socorro", "sogro", "soja", "solda",
|
||||
"soletrar", "solteiro", "sombrio", "sonata", "sondar", "sonegar", "sonhador", "sono", "soprano", "soquete",
|
||||
"sorrir", "sorteio", "sossego", "sotaque", "soterrar", "sovado", "sozinho", "suavizar", "subida", "submerso",
|
||||
"subsolo", "subtrair", "sucata", "sucesso", "suco", "sudeste", "sufixo", "sugador", "sugerir", "sujeito", "sulfato",
|
||||
"sumir", "suor", "superior", "suplicar", "suposto", "suprimir", "surdina", "surfista", "surpresa", "surreal",
|
||||
"surtir", "suspiro", "sustento", "tabela", "tablete", "tabuada", "tacho", "tagarela", "talher", "talo", "talvez",
|
||||
"tamanho", "tamborim", "tampa", "tangente", "tanto", "tapar", "tapioca", "tardio", "tarefa", "tarja", "tarraxa",
|
||||
"tatuagem", "taurino", "taxativo", "taxista", "teatral", "tecer", "tecido", "teclado", "tedioso", "teia", "teimar",
|
||||
"telefone", "telhado", "tempero", "tenente", "tensor", "tentar", "termal", "terno", "terreno", "tese", "tesoura",
|
||||
"testado", "teto", "textura", "texugo", "tiara", "tigela", "tijolo", "timbrar", "timidez", "tingido", "tinteiro",
|
||||
"tiragem", "titular", "toalha", "tocha", "tolerar", "tolice", "tomada", "tomilho", "tonel", "tontura", "topete",
|
||||
"tora", "torcido", "torneio", "torque", "torrada", "torto", "tostar", "touca", "toupeira", "toxina", "trabalho",
|
||||
"tracejar", "tradutor", "trafegar", "trajeto", "trama", "trancar", "trapo", "traseiro", "tratador", "travar",
|
||||
"treino", "tremer", "trepidar", "trevo", "triagem", "tribo", "triciclo", "tridente", "trilogia", "trindade",
|
||||
"triplo", "triturar", "triunfal", "trocar", "trombeta", "trova", "trunfo", "truque", "tubular", "tucano", "tudo",
|
||||
"tulipa", "tupi", "turbo", "turma", "turquesa", "tutelar", "tutorial", "uivar", "umbigo", "unha", "unidade",
|
||||
"uniforme", "urologia", "urso", "urtiga", "urubu", "usado", "usina", "usufruir", "vacina", "vadiar", "vagaroso",
|
||||
"vaidoso", "vala", "valente", "validade", "valores", "vantagem", "vaqueiro", "varanda", "vareta", "varrer",
|
||||
"vascular", "vasilha", "vassoura", "vazar", "vazio", "veado", "vedar", "vegetar", "veicular", "veleiro", "velhice",
|
||||
"veludo", "vencedor", "vendaval", "venerar", "ventre", "verbal", "verdade", "vereador", "vergonha", "vermelho",
|
||||
"verniz", "versar", "vertente", "vespa", "vestido", "vetorial", "viaduto", "viagem", "viajar", "viatura",
|
||||
"vibrador", "videira", "vidraria", "viela", "viga", "vigente", "vigiar", "vigorar", "vilarejo", "vinco", "vinheta",
|
||||
"vinil", "violeta", "virada", "virtude", "visitar", "visto", "vitral", "viveiro", "vizinho", "voador", "voar",
|
||||
"vogal", "volante", "voleibol", "voltagem", "volumoso", "vontade", "vulto", "vuvuzela", "xadrez", "xarope", "xeque",
|
||||
"xeretar", "xerife", "xingar", "zangado", "zarpar", "zebu", "zelador", "zombar", "zoologia", "zumbido"]
|
||||
28
src/js/xwc-util.js
Normal file
28
src/js/xwc-util.js
Normal file
@@ -0,0 +1,28 @@
|
||||
function XWCbufferToAddress(pubBuf){
|
||||
const Buffer = libs.buffer.Buffer;
|
||||
const XWC_ADDRESS_PREFIX = "XWC";
|
||||
const XWC_NORMAL_ADDRESS_VERSION = "35"
|
||||
let addrData = libs.createHash("rmd160").update( libs.createHash("sha512").update(pubBuf).digest()).digest();
|
||||
let addrBuf = Buffer.concat([Buffer.from(XWC_NORMAL_ADDRESS_VERSION, "hex") ,addrData])
|
||||
let checksum = libs.createHash("rmd160").update(addrBuf).digest("hex").slice(0, 8);
|
||||
addrBuf = Buffer.concat([addrBuf, Buffer.from(checksum, "hex")]);
|
||||
return XWC_ADDRESS_PREFIX.concat(libs.bs58.encode(addrBuf));
|
||||
}
|
||||
|
||||
function XWCbufferToPublic(pubBuf) {
|
||||
const Buffer = libs.buffer.Buffer;
|
||||
const XWC_PUBLIC_PREFIX = "XWC";
|
||||
let checksum = libs.createHash("rmd160").update(pubBuf).digest("hex").slice(0, 8);
|
||||
pubBuf = Buffer.concat([pubBuf, Buffer.from(checksum, "hex")]);
|
||||
return XWC_PUBLIC_PREFIX.concat(libs.bs58.encode(pubBuf));
|
||||
}
|
||||
|
||||
function XWCbufferToPrivate(privBuf) {
|
||||
const Buffer = libs.buffer.Buffer;
|
||||
const XWC_PRIVATE_PREFIX = "80";
|
||||
privBuf = Buffer.concat([Buffer.from(XWC_PRIVATE_PREFIX, "hex"), privBuf]);
|
||||
let tmp = libs.createHash("sha256").update(privBuf).digest();
|
||||
let checksum = libs.createHash("sha256").update(tmp).digest("hex").slice(0, 8);
|
||||
privBuf = Buffer.concat([privBuf, Buffer.from(checksum, "hex")]);
|
||||
return libs.bs58.encode(privBuf);
|
||||
}
|
||||
File diff suppressed because one or more lines are too long
501
tests/package-lock.json
generated
Normal file
501
tests/package-lock.json
generated
Normal file
@@ -0,0 +1,501 @@
|
||||
{
|
||||
"name": "tests",
|
||||
"version": "1.0.0",
|
||||
"lockfileVersion": 2,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "tests",
|
||||
"version": "1.0.0",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"jasmine": "^3.9.0",
|
||||
"selenium-webdriver": "^3.6.0"
|
||||
}
|
||||
},
|
||||
"node_modules/balanced-match": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz",
|
||||
"integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw=="
|
||||
},
|
||||
"node_modules/brace-expansion": {
|
||||
"version": "1.1.11",
|
||||
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz",
|
||||
"integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==",
|
||||
"dependencies": {
|
||||
"balanced-match": "^1.0.0",
|
||||
"concat-map": "0.0.1"
|
||||
}
|
||||
},
|
||||
"node_modules/concat-map": {
|
||||
"version": "0.0.1",
|
||||
"resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz",
|
||||
"integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s="
|
||||
},
|
||||
"node_modules/core-util-is": {
|
||||
"version": "1.0.3",
|
||||
"resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.3.tgz",
|
||||
"integrity": "sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ=="
|
||||
},
|
||||
"node_modules/fs.realpath": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz",
|
||||
"integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8="
|
||||
},
|
||||
"node_modules/glob": {
|
||||
"version": "7.2.0",
|
||||
"resolved": "https://registry.npmjs.org/glob/-/glob-7.2.0.tgz",
|
||||
"integrity": "sha512-lmLf6gtyrPq8tTjSmrO94wBeQbFR3HbLHbuyD69wuyQkImp2hWqMGB47OX65FBkPffO641IP9jWa1z4ivqG26Q==",
|
||||
"dependencies": {
|
||||
"fs.realpath": "^1.0.0",
|
||||
"inflight": "^1.0.4",
|
||||
"inherits": "2",
|
||||
"minimatch": "^3.0.4",
|
||||
"once": "^1.3.0",
|
||||
"path-is-absolute": "^1.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": "*"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/isaacs"
|
||||
}
|
||||
},
|
||||
"node_modules/immediate": {
|
||||
"version": "3.0.6",
|
||||
"resolved": "https://registry.npmjs.org/immediate/-/immediate-3.0.6.tgz",
|
||||
"integrity": "sha1-nbHb0Pr43m++D13V5Wu2BigN5ps="
|
||||
},
|
||||
"node_modules/inflight": {
|
||||
"version": "1.0.6",
|
||||
"resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz",
|
||||
"integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=",
|
||||
"dependencies": {
|
||||
"once": "^1.3.0",
|
||||
"wrappy": "1"
|
||||
}
|
||||
},
|
||||
"node_modules/inherits": {
|
||||
"version": "2.0.4",
|
||||
"resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz",
|
||||
"integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ=="
|
||||
},
|
||||
"node_modules/isarray": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz",
|
||||
"integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE="
|
||||
},
|
||||
"node_modules/jasmine": {
|
||||
"version": "3.9.0",
|
||||
"resolved": "https://registry.npmjs.org/jasmine/-/jasmine-3.9.0.tgz",
|
||||
"integrity": "sha512-JgtzteG7xnqZZ51fg7N2/wiQmXon09szkALcRMTgCMX4u/m17gVJFjObnvw5FXkZOWuweHPaPRVB6DI2uN0wVA==",
|
||||
"dependencies": {
|
||||
"glob": "^7.1.6",
|
||||
"jasmine-core": "~3.9.0"
|
||||
},
|
||||
"bin": {
|
||||
"jasmine": "bin/jasmine.js"
|
||||
}
|
||||
},
|
||||
"node_modules/jasmine-core": {
|
||||
"version": "3.9.0",
|
||||
"resolved": "https://registry.npmjs.org/jasmine-core/-/jasmine-core-3.9.0.tgz",
|
||||
"integrity": "sha512-Tv3kVbPCGVrjsnHBZ38NsPU3sDOtNa0XmbG2baiyJqdb5/SPpDO6GVwJYtUryl6KB4q1Ssckwg612ES9Z0dreQ=="
|
||||
},
|
||||
"node_modules/jszip": {
|
||||
"version": "3.7.1",
|
||||
"resolved": "https://registry.npmjs.org/jszip/-/jszip-3.7.1.tgz",
|
||||
"integrity": "sha512-ghL0tz1XG9ZEmRMcEN2vt7xabrDdqHHeykgARpmZ0BiIctWxM47Vt63ZO2dnp4QYt/xJVLLy5Zv1l/xRdh2byg==",
|
||||
"dependencies": {
|
||||
"lie": "~3.3.0",
|
||||
"pako": "~1.0.2",
|
||||
"readable-stream": "~2.3.6",
|
||||
"set-immediate-shim": "~1.0.1"
|
||||
}
|
||||
},
|
||||
"node_modules/lie": {
|
||||
"version": "3.3.0",
|
||||
"resolved": "https://registry.npmjs.org/lie/-/lie-3.3.0.tgz",
|
||||
"integrity": "sha512-UaiMJzeWRlEujzAuw5LokY1L5ecNQYZKfmyZ9L7wDHb/p5etKaxXhohBcrw0EYby+G/NA52vRSN4N39dxHAIwQ==",
|
||||
"dependencies": {
|
||||
"immediate": "~3.0.5"
|
||||
}
|
||||
},
|
||||
"node_modules/minimatch": {
|
||||
"version": "3.0.4",
|
||||
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz",
|
||||
"integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==",
|
||||
"dependencies": {
|
||||
"brace-expansion": "^1.1.7"
|
||||
},
|
||||
"engines": {
|
||||
"node": "*"
|
||||
}
|
||||
},
|
||||
"node_modules/once": {
|
||||
"version": "1.4.0",
|
||||
"resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz",
|
||||
"integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=",
|
||||
"dependencies": {
|
||||
"wrappy": "1"
|
||||
}
|
||||
},
|
||||
"node_modules/os-tmpdir": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz",
|
||||
"integrity": "sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ=",
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
}
|
||||
},
|
||||
"node_modules/pako": {
|
||||
"version": "1.0.11",
|
||||
"resolved": "https://registry.npmjs.org/pako/-/pako-1.0.11.tgz",
|
||||
"integrity": "sha512-4hLB8Py4zZce5s4yd9XzopqwVv/yGNhV1Bl8NTmCq1763HeK2+EwVTv+leGeL13Dnh2wfbqowVPXCIO0z4taYw=="
|
||||
},
|
||||
"node_modules/path-is-absolute": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz",
|
||||
"integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=",
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
}
|
||||
},
|
||||
"node_modules/process-nextick-args": {
|
||||
"version": "2.0.1",
|
||||
"resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz",
|
||||
"integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag=="
|
||||
},
|
||||
"node_modules/readable-stream": {
|
||||
"version": "2.3.7",
|
||||
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.7.tgz",
|
||||
"integrity": "sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw==",
|
||||
"dependencies": {
|
||||
"core-util-is": "~1.0.0",
|
||||
"inherits": "~2.0.3",
|
||||
"isarray": "~1.0.0",
|
||||
"process-nextick-args": "~2.0.0",
|
||||
"safe-buffer": "~5.1.1",
|
||||
"string_decoder": "~1.1.1",
|
||||
"util-deprecate": "~1.0.1"
|
||||
}
|
||||
},
|
||||
"node_modules/rimraf": {
|
||||
"version": "2.7.1",
|
||||
"resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.7.1.tgz",
|
||||
"integrity": "sha512-uWjbaKIK3T1OSVptzX7Nl6PvQ3qAGtKEtVRjRuazjfL3Bx5eI409VZSqgND+4UNnmzLVdPj9FqFJNPqBZFve4w==",
|
||||
"dependencies": {
|
||||
"glob": "^7.1.3"
|
||||
},
|
||||
"bin": {
|
||||
"rimraf": "bin.js"
|
||||
}
|
||||
},
|
||||
"node_modules/safe-buffer": {
|
||||
"version": "5.1.2",
|
||||
"resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz",
|
||||
"integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g=="
|
||||
},
|
||||
"node_modules/sax": {
|
||||
"version": "1.2.4",
|
||||
"resolved": "https://registry.npmjs.org/sax/-/sax-1.2.4.tgz",
|
||||
"integrity": "sha512-NqVDv9TpANUjFm0N8uM5GxL36UgKi9/atZw+x7YFnQ8ckwFGKrl4xX4yWtrey3UJm5nP1kUbnYgLopqWNSRhWw=="
|
||||
},
|
||||
"node_modules/selenium-webdriver": {
|
||||
"version": "3.6.0",
|
||||
"resolved": "https://registry.npmjs.org/selenium-webdriver/-/selenium-webdriver-3.6.0.tgz",
|
||||
"integrity": "sha512-WH7Aldse+2P5bbFBO4Gle/nuQOdVwpHMTL6raL3uuBj/vPG07k6uzt3aiahu352ONBr5xXh0hDlM3LhtXPOC4Q==",
|
||||
"dependencies": {
|
||||
"jszip": "^3.1.3",
|
||||
"rimraf": "^2.5.4",
|
||||
"tmp": "0.0.30",
|
||||
"xml2js": "^0.4.17"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 6.9.0"
|
||||
}
|
||||
},
|
||||
"node_modules/set-immediate-shim": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/set-immediate-shim/-/set-immediate-shim-1.0.1.tgz",
|
||||
"integrity": "sha1-SysbJ+uAip+NzEgaWOXlb1mfP2E=",
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
}
|
||||
},
|
||||
"node_modules/string_decoder": {
|
||||
"version": "1.1.1",
|
||||
"resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz",
|
||||
"integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==",
|
||||
"dependencies": {
|
||||
"safe-buffer": "~5.1.0"
|
||||
}
|
||||
},
|
||||
"node_modules/tmp": {
|
||||
"version": "0.0.30",
|
||||
"resolved": "https://registry.npmjs.org/tmp/-/tmp-0.0.30.tgz",
|
||||
"integrity": "sha1-ckGdSovn1s51FI/YsyTlk6cRwu0=",
|
||||
"dependencies": {
|
||||
"os-tmpdir": "~1.0.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.4.0"
|
||||
}
|
||||
},
|
||||
"node_modules/util-deprecate": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz",
|
||||
"integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8="
|
||||
},
|
||||
"node_modules/wrappy": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz",
|
||||
"integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8="
|
||||
},
|
||||
"node_modules/xml2js": {
|
||||
"version": "0.4.23",
|
||||
"resolved": "https://registry.npmjs.org/xml2js/-/xml2js-0.4.23.tgz",
|
||||
"integrity": "sha512-ySPiMjM0+pLDftHgXY4By0uswI3SPKLDw/i3UXbnO8M/p28zqexCUoPmQFrYD+/1BzhGJSs2i1ERWKJAtiLrug==",
|
||||
"dependencies": {
|
||||
"sax": ">=0.6.0",
|
||||
"xmlbuilder": "~11.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=4.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/xmlbuilder": {
|
||||
"version": "11.0.1",
|
||||
"resolved": "https://registry.npmjs.org/xmlbuilder/-/xmlbuilder-11.0.1.tgz",
|
||||
"integrity": "sha512-fDlsI/kFEx7gLvbecc0/ohLG50fugQp8ryHzMTuW9vSa1GJ0XYWKnhsUx7oie3G98+r56aTQIUB4kht42R3JvA==",
|
||||
"engines": {
|
||||
"node": ">=4.0"
|
||||
}
|
||||
}
|
||||
},
|
||||
"dependencies": {
|
||||
"balanced-match": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz",
|
||||
"integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw=="
|
||||
},
|
||||
"brace-expansion": {
|
||||
"version": "1.1.11",
|
||||
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz",
|
||||
"integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==",
|
||||
"requires": {
|
||||
"balanced-match": "^1.0.0",
|
||||
"concat-map": "0.0.1"
|
||||
}
|
||||
},
|
||||
"concat-map": {
|
||||
"version": "0.0.1",
|
||||
"resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz",
|
||||
"integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s="
|
||||
},
|
||||
"core-util-is": {
|
||||
"version": "1.0.3",
|
||||
"resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.3.tgz",
|
||||
"integrity": "sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ=="
|
||||
},
|
||||
"fs.realpath": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz",
|
||||
"integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8="
|
||||
},
|
||||
"glob": {
|
||||
"version": "7.2.0",
|
||||
"resolved": "https://registry.npmjs.org/glob/-/glob-7.2.0.tgz",
|
||||
"integrity": "sha512-lmLf6gtyrPq8tTjSmrO94wBeQbFR3HbLHbuyD69wuyQkImp2hWqMGB47OX65FBkPffO641IP9jWa1z4ivqG26Q==",
|
||||
"requires": {
|
||||
"fs.realpath": "^1.0.0",
|
||||
"inflight": "^1.0.4",
|
||||
"inherits": "2",
|
||||
"minimatch": "^3.0.4",
|
||||
"once": "^1.3.0",
|
||||
"path-is-absolute": "^1.0.0"
|
||||
}
|
||||
},
|
||||
"immediate": {
|
||||
"version": "3.0.6",
|
||||
"resolved": "https://registry.npmjs.org/immediate/-/immediate-3.0.6.tgz",
|
||||
"integrity": "sha1-nbHb0Pr43m++D13V5Wu2BigN5ps="
|
||||
},
|
||||
"inflight": {
|
||||
"version": "1.0.6",
|
||||
"resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz",
|
||||
"integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=",
|
||||
"requires": {
|
||||
"once": "^1.3.0",
|
||||
"wrappy": "1"
|
||||
}
|
||||
},
|
||||
"inherits": {
|
||||
"version": "2.0.4",
|
||||
"resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz",
|
||||
"integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ=="
|
||||
},
|
||||
"isarray": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz",
|
||||
"integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE="
|
||||
},
|
||||
"jasmine": {
|
||||
"version": "3.9.0",
|
||||
"resolved": "https://registry.npmjs.org/jasmine/-/jasmine-3.9.0.tgz",
|
||||
"integrity": "sha512-JgtzteG7xnqZZ51fg7N2/wiQmXon09szkALcRMTgCMX4u/m17gVJFjObnvw5FXkZOWuweHPaPRVB6DI2uN0wVA==",
|
||||
"requires": {
|
||||
"glob": "^7.1.6",
|
||||
"jasmine-core": "~3.9.0"
|
||||
}
|
||||
},
|
||||
"jasmine-core": {
|
||||
"version": "3.9.0",
|
||||
"resolved": "https://registry.npmjs.org/jasmine-core/-/jasmine-core-3.9.0.tgz",
|
||||
"integrity": "sha512-Tv3kVbPCGVrjsnHBZ38NsPU3sDOtNa0XmbG2baiyJqdb5/SPpDO6GVwJYtUryl6KB4q1Ssckwg612ES9Z0dreQ=="
|
||||
},
|
||||
"jszip": {
|
||||
"version": "3.7.1",
|
||||
"resolved": "https://registry.npmjs.org/jszip/-/jszip-3.7.1.tgz",
|
||||
"integrity": "sha512-ghL0tz1XG9ZEmRMcEN2vt7xabrDdqHHeykgARpmZ0BiIctWxM47Vt63ZO2dnp4QYt/xJVLLy5Zv1l/xRdh2byg==",
|
||||
"requires": {
|
||||
"lie": "~3.3.0",
|
||||
"pako": "~1.0.2",
|
||||
"readable-stream": "~2.3.6",
|
||||
"set-immediate-shim": "~1.0.1"
|
||||
}
|
||||
},
|
||||
"lie": {
|
||||
"version": "3.3.0",
|
||||
"resolved": "https://registry.npmjs.org/lie/-/lie-3.3.0.tgz",
|
||||
"integrity": "sha512-UaiMJzeWRlEujzAuw5LokY1L5ecNQYZKfmyZ9L7wDHb/p5etKaxXhohBcrw0EYby+G/NA52vRSN4N39dxHAIwQ==",
|
||||
"requires": {
|
||||
"immediate": "~3.0.5"
|
||||
}
|
||||
},
|
||||
"minimatch": {
|
||||
"version": "3.0.4",
|
||||
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz",
|
||||
"integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==",
|
||||
"requires": {
|
||||
"brace-expansion": "^1.1.7"
|
||||
}
|
||||
},
|
||||
"once": {
|
||||
"version": "1.4.0",
|
||||
"resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz",
|
||||
"integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=",
|
||||
"requires": {
|
||||
"wrappy": "1"
|
||||
}
|
||||
},
|
||||
"os-tmpdir": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz",
|
||||
"integrity": "sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ="
|
||||
},
|
||||
"pako": {
|
||||
"version": "1.0.11",
|
||||
"resolved": "https://registry.npmjs.org/pako/-/pako-1.0.11.tgz",
|
||||
"integrity": "sha512-4hLB8Py4zZce5s4yd9XzopqwVv/yGNhV1Bl8NTmCq1763HeK2+EwVTv+leGeL13Dnh2wfbqowVPXCIO0z4taYw=="
|
||||
},
|
||||
"path-is-absolute": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz",
|
||||
"integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18="
|
||||
},
|
||||
"process-nextick-args": {
|
||||
"version": "2.0.1",
|
||||
"resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz",
|
||||
"integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag=="
|
||||
},
|
||||
"readable-stream": {
|
||||
"version": "2.3.7",
|
||||
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.7.tgz",
|
||||
"integrity": "sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw==",
|
||||
"requires": {
|
||||
"core-util-is": "~1.0.0",
|
||||
"inherits": "~2.0.3",
|
||||
"isarray": "~1.0.0",
|
||||
"process-nextick-args": "~2.0.0",
|
||||
"safe-buffer": "~5.1.1",
|
||||
"string_decoder": "~1.1.1",
|
||||
"util-deprecate": "~1.0.1"
|
||||
}
|
||||
},
|
||||
"rimraf": {
|
||||
"version": "2.7.1",
|
||||
"resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.7.1.tgz",
|
||||
"integrity": "sha512-uWjbaKIK3T1OSVptzX7Nl6PvQ3qAGtKEtVRjRuazjfL3Bx5eI409VZSqgND+4UNnmzLVdPj9FqFJNPqBZFve4w==",
|
||||
"requires": {
|
||||
"glob": "^7.1.3"
|
||||
}
|
||||
},
|
||||
"safe-buffer": {
|
||||
"version": "5.1.2",
|
||||
"resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz",
|
||||
"integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g=="
|
||||
},
|
||||
"sax": {
|
||||
"version": "1.2.4",
|
||||
"resolved": "https://registry.npmjs.org/sax/-/sax-1.2.4.tgz",
|
||||
"integrity": "sha512-NqVDv9TpANUjFm0N8uM5GxL36UgKi9/atZw+x7YFnQ8ckwFGKrl4xX4yWtrey3UJm5nP1kUbnYgLopqWNSRhWw=="
|
||||
},
|
||||
"selenium-webdriver": {
|
||||
"version": "3.6.0",
|
||||
"resolved": "https://registry.npmjs.org/selenium-webdriver/-/selenium-webdriver-3.6.0.tgz",
|
||||
"integrity": "sha512-WH7Aldse+2P5bbFBO4Gle/nuQOdVwpHMTL6raL3uuBj/vPG07k6uzt3aiahu352ONBr5xXh0hDlM3LhtXPOC4Q==",
|
||||
"requires": {
|
||||
"jszip": "^3.1.3",
|
||||
"rimraf": "^2.5.4",
|
||||
"tmp": "0.0.30",
|
||||
"xml2js": "^0.4.17"
|
||||
}
|
||||
},
|
||||
"set-immediate-shim": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/set-immediate-shim/-/set-immediate-shim-1.0.1.tgz",
|
||||
"integrity": "sha1-SysbJ+uAip+NzEgaWOXlb1mfP2E="
|
||||
},
|
||||
"string_decoder": {
|
||||
"version": "1.1.1",
|
||||
"resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz",
|
||||
"integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==",
|
||||
"requires": {
|
||||
"safe-buffer": "~5.1.0"
|
||||
}
|
||||
},
|
||||
"tmp": {
|
||||
"version": "0.0.30",
|
||||
"resolved": "https://registry.npmjs.org/tmp/-/tmp-0.0.30.tgz",
|
||||
"integrity": "sha1-ckGdSovn1s51FI/YsyTlk6cRwu0=",
|
||||
"requires": {
|
||||
"os-tmpdir": "~1.0.1"
|
||||
}
|
||||
},
|
||||
"util-deprecate": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz",
|
||||
"integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8="
|
||||
},
|
||||
"wrappy": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz",
|
||||
"integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8="
|
||||
},
|
||||
"xml2js": {
|
||||
"version": "0.4.23",
|
||||
"resolved": "https://registry.npmjs.org/xml2js/-/xml2js-0.4.23.tgz",
|
||||
"integrity": "sha512-ySPiMjM0+pLDftHgXY4By0uswI3SPKLDw/i3UXbnO8M/p28zqexCUoPmQFrYD+/1BzhGJSs2i1ERWKJAtiLrug==",
|
||||
"requires": {
|
||||
"sax": ">=0.6.0",
|
||||
"xmlbuilder": "~11.0.0"
|
||||
}
|
||||
},
|
||||
"xmlbuilder": {
|
||||
"version": "11.0.1",
|
||||
"resolved": "https://registry.npmjs.org/xmlbuilder/-/xmlbuilder-11.0.1.tgz",
|
||||
"integrity": "sha512-fDlsI/kFEx7gLvbecc0/ohLG50fugQp8ryHzMTuW9vSa1GJ0XYWKnhsUx7oie3G98+r56aTQIUB4kht42R3JvA=="
|
||||
}
|
||||
}
|
||||
}
|
||||
18
tests/package.json
Normal file
18
tests/package.json
Normal file
@@ -0,0 +1,18 @@
|
||||
{
|
||||
"name": "tests",
|
||||
"version": "1.0.0",
|
||||
"scripts": {
|
||||
"test": "jasmine spec/tests.js"
|
||||
},
|
||||
"author": "Ian coleman",
|
||||
"description": "Tests for BIP39 tool",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/iancoleman/bip39.git"
|
||||
},
|
||||
"dependencies": {
|
||||
"jasmine": "^3.9.0",
|
||||
"selenium-webdriver": "^3.6.0"
|
||||
},
|
||||
"license": "MIT"
|
||||
}
|
||||
11
tests/spec/support/jasmine.json
Normal file
11
tests/spec/support/jasmine.json
Normal file
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"spec_dir": "spec",
|
||||
"spec_files": [
|
||||
"**/*[sS]pec.js"
|
||||
],
|
||||
"helpers": [
|
||||
"helpers/**/*.js"
|
||||
],
|
||||
"stopSpecOnExpectationFailure": false,
|
||||
"random": false
|
||||
}
|
||||
5250
tests/spec/tests.js
Normal file
5250
tests/spec/tests.js
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user