Files: 95bb9a6860cffaf97428b81d6600e7b668345654 / main.js
674 bytesRaw
1 | var ssbKeys = require('ssb-keys') |
2 | var checkWord = require('check-word'), |
3 | words = checkWord('en'); |
4 | |
5 | |
6 | while(true) |
7 | { |
8 | // get candidate keys |
9 | var key = ssbKeys.generate() |
10 | var pub_key = key.public |
11 | |
12 | // split into 4..7 word chunks |
13 | var possible_words = [] |
14 | var min_size = 5 |
15 | var max_size = 7 |
16 | |
17 | for(i = min_size; i <= max_size; i++) |
18 | { |
19 | possible_words.push(pub_key.substring( 0, i )) |
20 | } |
21 | |
22 | for(var word of possible_words) { |
23 | // check if only letters (+++ SPEED) |
24 | if( is_letters(word) ) |
25 | { |
26 | // check if in dictionary |
27 | if(words.check(word)) |
28 | console.log(key) |
29 | } |
30 | } |
31 | } |
32 | |
33 | |
34 | function is_letters(str) |
35 | { |
36 | return /^[a-zA-Z]+$/.test(str) |
37 | } |
38 |
Built with git-ssb-web