From f46ae7d7316e767b0473e1dbd7afeeb9d10890be Mon Sep 17 00:00:00 2001 From: Pavel 'PK' Kaminsky Date: Fri, 29 Dec 2017 00:55:16 +0200 Subject: [PATCH] crypto.sha256 should receive a Buffer as an input rather than a string checked and it works with buffers. if you wanted to use string implicitly, the function parameter should be renamed from buffer to string. https://github.com/bitcoinjs/bitcoinjs-lib/blob/f4caaf42e7b58332d74c1540f88bcda7e55b82e6/src/crypto.js#L11 --- test/integration/addresses.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/integration/addresses.js b/test/integration/addresses.js index cc174a2..70f0ec7 100644 --- a/test/integration/addresses.js +++ b/test/integration/addresses.js @@ -17,7 +17,7 @@ describe('bitcoinjs-lib (addresses)', function () { }) it('can generate an address from a SHA256 hash', function () { - var hash = bitcoin.crypto.sha256('correct horse battery staple') + var hash = bitcoin.crypto.sha256(Buffer.from('correct horse battery staple')) var d = bigi.fromBuffer(hash) var keyPair = new bitcoin.ECPair(d)