diff --git a/packages/ripple-keypairs/src/index.ts b/packages/ripple-keypairs/src/index.ts index 00e79b21..ef54526b 100644 --- a/packages/ripple-keypairs/src/index.ts +++ b/packages/ripple-keypairs/src/index.ts @@ -26,11 +26,7 @@ function generateSeed( } function hash(message): number[] { - return hashjs - .sha512() - .update(message) - .digest() - .slice(0, 32) + return hashjs.sha512().update(message).digest().slice(0, 32) } const secp256k1 = { @@ -44,10 +40,7 @@ const secp256k1 = { const prefix = '00' const privateKey = - prefix + - derivePrivateKey(entropy, options) - .toString(16, 64) - .toUpperCase() + prefix + derivePrivateKey(entropy, options).toString(16, 64).toUpperCase() const publicKey = bytesToHex( Secp256k1.keyFromPrivate(privateKey.slice(2)) diff --git a/packages/ripple-keypairs/src/utils.ts b/packages/ripple-keypairs/src/utils.ts index a2694cc9..98c48ed0 100644 --- a/packages/ripple-keypairs/src/utils.ts +++ b/packages/ripple-keypairs/src/utils.ts @@ -17,15 +17,9 @@ function hexToBytes(a): number[] { } function computePublicKeyHash(publicKeyBytes: Buffer): Buffer { - const hash256 = hashjs - .sha256() - .update(publicKeyBytes) - .digest() + const hash256 = hashjs.sha256().update(publicKeyBytes).digest() - const hash160 = hashjs - .ripemd160() - .update(hash256) - .digest() + const hash160 = hashjs.ripemd160().update(hash256).digest() return Buffer.from(hash160) }