]> git.immae.eu Git - perso/Immae/Projets/Cryptomonnaies/BIP39.git/commitdiff
mnemonic.normalizeString method made public
authorIan Coleman <coleman.ian@gmail.com>
Sat, 27 Sep 2014 11:50:48 +0000 (21:50 +1000)
committerIan Coleman <coleman.ian@gmail.com>
Sat, 27 Sep 2014 11:50:48 +0000 (21:50 +1000)
bip39-standalone.html
src/js/jsbip39.js

index 41634c25763135747fbdf0295d455c6da315dbcc..b062b2e3c4aa9bfaf06c4aa60b9b2477240f3283 100644 (file)
@@ -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");
         }
index d0ac3ae168a1bfc67f0c542aebba71d00ae4f67b..7acf77b6c5d9bb96916076013e387cd8abc7a20e 100644 (file)
@@ -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");
         }