Files
minibits_wallet/patches/@scure+bip32+2.2.0.patch
T
2026-05-11 22:33:22 +02:00

33 lines
1.7 KiB
Diff

diff --git a/node_modules/@scure/bip32/index.js b/node_modules/@scure/bip32/index.js
index 8e49612..d54da85 100644
--- a/node_modules/@scure/bip32/index.js
+++ b/node_modules/@scure/bip32/index.js
@@ -28,6 +28,7 @@ import { ripemd160 } from '@noble/hashes/legacy.js';
import { sha256, sha512 } from '@noble/hashes/sha2.js';
import { abytes, concatBytes, createView } from '@noble/hashes/utils.js';
import { createBase58check } from '@scure/base';
+import quickCrypto from 'react-native-quick-crypto';
const Point = /* @__PURE__ */ (() => secp.Point)();
const Fn = /* @__PURE__ */ (() => Point.Fn)();
const base58check = /* @__PURE__ */ createBase58check(sha256);
@@ -102,7 +103,8 @@ export class HDKey {
throw new RangeError('HDKey: seed length must be between 128 and 512 bits; 256 bits is advised, got ' +
seed.length);
}
- const I = hmac(sha512, MASTER_SECRET, seed);
+ //const I = hmac(sha512, MASTER_SECRET, seed);
+ const I = new Uint8Array(quickCrypto.createHmac('sha512', MASTER_SECRET).update(seed).digest());
const privateKey = I.slice(0, 32);
const chainCode = I.slice(32);
return new HDKey({ versions, chainCode, privateKey });
@@ -225,7 +227,8 @@ export class HDKey {
// Normal child: serP(point(kpar)) || ser32(index)
data = concatBytes(this._publicKey, data);
}
- const out = _I || hmac(sha512, this.chainCode, data);
+ //const out = _I || hmac(sha512, this.chainCode, data);
+ const out = _I || new Uint8Array(quickCrypto.createHmac('sha512', this.chainCode).update(data).digest());
abytes(out, 64);
const childTweak = out.slice(0, 32);
const chainCode = out.slice(32);