mirror of https://github.com/status-im/bip39.git
add generateMnemonic
This commit is contained in:
parent
7b78cc5350
commit
d026bbe2ef
6
index.js
6
index.js
|
@ -30,6 +30,12 @@ BIP39.prototype.entropyToMnemonic = function(entropy){
|
|||
}, this).join(' ')
|
||||
}
|
||||
|
||||
BIP39.prototype.generateMnemonic = function(strength){
|
||||
var strength = strength || 128
|
||||
var entropy = crypto.randomBytes(strength/8).toString('hex')
|
||||
return this.entropyToMnemonic(entropy)
|
||||
}
|
||||
|
||||
function salt(password) {
|
||||
return encode_utf8('mnemonic' + (password || ''))
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue