Added support for phonetic key naming

Closes #7
This commit is contained in:
John Crepezzi 2012-01-07 11:35:11 -05:00
parent a958c66249
commit cc65e98940
6 changed files with 87 additions and 13 deletions

View file

@ -0,0 +1,14 @@
var RandomKeyGenerator = function(options) {
this.keyspace = options.keyspace || 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
};
// Generate a random key
RandomKeyGenerator.prototype.createKey = function(keyLength) {
var text = '';
for (var i = 0; i < keyLength; i++) {
text += this.keyspace.charAt(Math.floor(Math.random() * this.keyspace.length));
}
return text;
};
module.exports = RandomKeyGenerator;