Last active
January 2, 2018 02:23
Revisions
-
branneman renamed this gist
Mar 16, 2017 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
branneman revised this gist
Mar 16, 2017 . No changes.There are no files selected for viewing
-
branneman created this gist
Mar 16, 2017 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,34 @@ const map = fn => list => list.map(fn); const filter = fn => list => list.filter(fn); const compose = (...fns) => fns.reduce((f, g) => (...args) => f(g(...args))); const tail = list => list.slice(1); const fill = val => num => new Array(num).fill(val); const getFileContents = file => require('fs').readFileSync(file, { encoding: 'utf8' }); const split = char => str => str.split(char); const join = char => list => list.join(char); const isWordLine = str => /[1-6]{5}\t.+/.test(str); const getWordList = compose(map(split('\t')), filter(isWordLine), split('\n'), getFileContents); const wordList = getWordList('eff.wordlist.txt'); const roll1D6 = () => Math.round((Math.random() * 5) + 1); const roll5D6 = () => map(roll1D6)(fill(0)(5)); const getWord = n => wordList.find(i => i[0] === n); const getRandomWord = compose(join(' '), tail, getWord, join(''), roll5D6); const getRandomWords = compose(join(' '), map(getRandomWord), fill(0)); const app = len => compose(join('\n'), map(() => getRandomWords(len)), fill(0)); // // App // const numberOfWordsInPassword = 8; const numberOfPasswords = 25; const out = app(numberOfWordsInPassword)(numberOfPasswords); console.log(out); This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,17 @@ 11111 abacus 11112 abdomen 11113 abdominal 11114 abide 11115 abiding 11116 ability 11121 ablaze 11122 able 11123 abnormal 11124 abrasion 11125 abrasive 11126 abreast 11131 abridge 11132 abroad ... See: https://www.eff.org/files/2016/07/18/eff_large_wordlist.txt