Files
minibits_wallet/patches/@scure+bip39+2.0.1.patch
T

24 lines
1.3 KiB
Diff

diff --git a/node_modules/@scure/bip39/index.js b/node_modules/@scure/bip39/index.js
index a7db5ca..a7f0e85 100644
--- a/node_modules/@scure/bip39/index.js
+++ b/node_modules/@scure/bip39/index.js
@@ -4,6 +4,7 @@ import { sha256, sha512 } from '@noble/hashes/sha2.js';
import { abytes, anumber, randomBytes } from '@noble/hashes/utils.js';
import { pbkdf2 as pbkdf2web, sha512 as sha512web } from '@noble/hashes/webcrypto.js';
import { utils as baseUtils } from '@scure/base';
+import quickCrypto from 'react-native-quick-crypto'
// Japanese wordlist
const isJapanese = (wordlist) => wordlist[0] === '\u3042\u3044\u3053\u304f\u3057\u3093';
// Normalization replaces equivalent sequences of characters
@@ -131,7 +132,9 @@ export function mnemonicToSeed(mnemonic, passphrase = '') {
* // new Uint8Array([...64 bytes])
*/
export function mnemonicToSeedSync(mnemonic, passphrase = '') {
- return pbkdf2(sha512, normalize(mnemonic).nfkd, psalt(passphrase), { c: 2048, dkLen: 64 });
+ //return pbkdf2(sha512, normalize(mnemonic).nfkd, psalt(passphrase), { c: 2048, dkLen: 64 });
+ console.log('[bip39.mnemonicToSeedSync] Using ESM quickCrypto PBKDF2 Sync');
+ return new Uint8Array(quickCrypto.pbkdf2Sync(normalize(mnemonic).nfkd, psalt(passphrase), 2048, 64, 'sha512'));
}
/**
* Uses native, built-in functionality, provided by globalThis.crypto.