|
|
|
@ -1,5 +1,4 @@ |
|
|
|
|
var fs = require('fs') |
|
|
|
|
var dictionary; |
|
|
|
|
|
|
|
|
|
var DictionaryGenerator = function(options) { |
|
|
|
|
//Options
|
|
|
|
@ -18,10 +17,8 @@ var DictionaryGenerator = function(options) { |
|
|
|
|
//Generates a dictionary-based key, of keyLength words
|
|
|
|
|
DictionaryGenerator.prototype.createKey = function(keyLength) { |
|
|
|
|
var text = ''; |
|
|
|
|
for(var i = 0; i < keyLength; i++) { |
|
|
|
|
var index =Math.floor(Math.random()*this.dictionary.length); |
|
|
|
|
text += this.dictionary[index]; |
|
|
|
|
} |
|
|
|
|
for(var i = 0; i < keyLength; i++) |
|
|
|
|
text += this.dictionary[Math.floor(Math.random()*this.dictionary.length)]; |
|
|
|
|
|
|
|
|
|
return text; |
|
|
|
|
}; |
|
|
|
|