Browse Source

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.
f4caaf42e7/src/crypto.js (L11)
hk-custom-address
Pavel 'PK' Kaminsky 7 years ago
committed by GitHub
parent
commit
f46ae7d731
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      test/integration/addresses.js

2
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)

Loading…
Cancel
Save