mirror of
https://github.com/OneKeyHQ/bip39.git
synced 2026-04-05 18:43:47 +00:00
mnemonic.normalizeString method made public
This commit is contained in:
@@ -22432,14 +22432,14 @@ var Mnemonic = function(language) {
|
||||
|
||||
self.toSeed = function(mnemonic, passphrase) {
|
||||
passphrase = passphrase || '';
|
||||
mnemonic = normalizeString(mnemonic)
|
||||
passphrase = normalizeString(passphrase)
|
||||
mnemonic = self.normalizeString(mnemonic)
|
||||
passphrase = self.normalizeString(passphrase)
|
||||
passphrase = "mnemonic" + passphrase;
|
||||
//return PBKDF2(mnemonic, 'mnemonic' + passphrase, iterations=PBKDF2_ROUNDS, macmodule=hmac, digestmodule=hashlib.sha512).read(64)
|
||||
return asmCrypto.PBKDF2_HMAC_SHA512.hex(mnemonic, passphrase, PBKDF2_ROUNDS, 512/8);
|
||||
}
|
||||
|
||||
function normalizeString(str) {
|
||||
self.normalizeString = function(str) {
|
||||
if (typeof str.normalize == "function") {
|
||||
return str.normalize("NFKD");
|
||||
}
|
||||
|
||||
@@ -121,14 +121,14 @@ var Mnemonic = function(language) {
|
||||
|
||||
self.toSeed = function(mnemonic, passphrase) {
|
||||
passphrase = passphrase || '';
|
||||
mnemonic = normalizeString(mnemonic)
|
||||
passphrase = normalizeString(passphrase)
|
||||
mnemonic = self.normalizeString(mnemonic)
|
||||
passphrase = self.normalizeString(passphrase)
|
||||
passphrase = "mnemonic" + passphrase;
|
||||
//return PBKDF2(mnemonic, 'mnemonic' + passphrase, iterations=PBKDF2_ROUNDS, macmodule=hmac, digestmodule=hashlib.sha512).read(64)
|
||||
return asmCrypto.PBKDF2_HMAC_SHA512.hex(mnemonic, passphrase, PBKDF2_ROUNDS, 512/8);
|
||||
}
|
||||
|
||||
function normalizeString(str) {
|
||||
self.normalizeString = function(str) {
|
||||
if (typeof str.normalize == "function") {
|
||||
return str.normalize("NFKD");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user