Skip to content

Commit aac2280

Browse files
committed
README: rm bad sha256 hash example
1 parent a908e90 commit aac2280

File tree

2 files changed

+0
-12
lines changed

2 files changed

+0
-12
lines changed

README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,6 @@ Otherwise, pull requests are appreciated.
109109
Some examples interact (via HTTPS) with a 3rd Party Blockchain Provider (3PBP).
110110

111111
- [Generate a random address](https://github.com/bitcoinjs/bitcoinjs-lib/blob/master/test/integration/addresses.js#L22)
112-
- [Generate an address from a SHA256 hash](https://github.com/bitcoinjs/bitcoinjs-lib/blob/master/test/integration/addresses.js#L29)
113112
- [Import an address via WIF](https://github.com/bitcoinjs/bitcoinjs-lib/blob/master/test/integration/addresses.js#L40)
114113
- [Generate a 2-of-3 P2SH multisig address](https://github.com/bitcoinjs/bitcoinjs-lib/blob/master/test/integration/addresses.js#L47)
115114
- [Generate a SegWit address](https://github.com/bitcoinjs/bitcoinjs-lib/blob/master/test/integration/addresses.js#L60)

test/integration/addresses.js

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -25,17 +25,6 @@ describe('bitcoinjs-lib (addresses)', function () {
2525
assert.strictEqual(address, '1F5VhMHukdnUES9kfXqzPzMeF1GPHKiF64')
2626
})
2727

28-
it('can generate an address from a SHA256 hash', function () {
29-
const hash = bitcoin.crypto.sha256(Buffer.from('correct horse battery staple'))
30-
31-
const keyPair = bitcoin.ECPair.fromPrivateKey(hash)
32-
const { address } = bitcoin.payments.p2pkh({ pubkey: keyPair.publicKey })
33-
34-
// Generating addresses from SHA256 hashes is not secure if the input to the hash function is predictable
35-
// Do not use with predictable inputs
36-
assert.strictEqual(address, '1C7zdTfnkzmr13HfA2vNm5SJYRK6nEKyq8')
37-
})
38-
3928
it('can import an address via WIF', function () {
4029
const keyPair = bitcoin.ECPair.fromWIF('Kxr9tQED9H44gCmp6HAdmemAzU3n84H3dGkuWTKvE23JgHMW8gct')
4130
const { address } = bitcoin.payments.p2pkh({ pubkey: keyPair.publicKey })

0 commit comments

Comments
 (0)