1.1.5 • Published 7 years ago

bip66 v1.1.5

Weekly downloads
103,050
License
MIT
Repository
github
Last release
7 years ago

bip66

NPM Package Build Status

js-standard-style

Strict DER signature encoding/decoding.

See bip66.

  • This module works only with two's complement numbers.
  • BIP66 doesn't check that r or s are fully valid.
    • check/decode doesn't check that r or s great than 33 bytes or that this number represent valid point on elliptic curve.
    • encode doesn't check that r/s represent valid point on elliptic curve.

Example

var bip66 = require('bip66')
var r = new Buffer('1ea1fdff81b3a271659df4aad19bc4ef83def389131a36358fe64b245632e777', 'hex')
var s = new Buffer('29e164658be9ce810921bf81d6b86694785a79ea1e52dbfa5105148d1f0bc1', 'hex')

bip66.encode(r, s)
// Buffer <30 43 02 20 1e a1 fd ff 81 b3 a2 71 65 9d f4 aa d1 9b c4 ef 83 de f3 89 13 1a 36 35 8f e6 4b 24 56 32 e7 77 02 1f 29 e1 64 65 8b e9 ce 81 09 21 bf 81 d6 b8 66 94 78 5a 79 ea 1e 52 db fa 51 05 14 8d 1f 0b c1>

var signature = new Buffer('304302201ea1fdff81b3a271659df4aad19bc4ef83def389131a36358fe64b245632e777021f29e164658be9ce810921bf81d6b86694785a79ea1e52dbfa5105148d1f0bc1', 'hex')
bip66.decode(signature)
// => {
//	r: Buffer <1e a1 fd ff 81 b3 a2 71 65 9d f4 aa d1 9b c4 ef 83 de f3 89 13 1a 36 35 8f e6 4b 24 56 32 e7 77>,
//	s: Buffer <29 e1 64 65 8b e9 ce 81 09 21 bf 81 d6 b8 66 94 78 5a 79 ea 1e 52 db fa 51 05 14 8d 1f 0b c1>
// }

A catch-all exception regex:

/Expected DER (integer|sequence)|(R|S) value (excessively padded|is negative)|(R|S|DER sequence) length is (zero|too short|too long|invalid)/

LICENSE MIT

aiot-jsswiftcashjs-libwocode-wallet-qitmeerwocode-wallet-ubsecux-connectreact-native-bitcoincashjs-libtrezor-utxo-libqtum-qnektbitgo-utxo-lib-pslbch-js-joey@rogerfelipe/digibyte-toolbox-jsliquidjs-lib-taprootubchain-jsuworld-js@everything-registry/sub-chunk-1237bch-js-test@asoltys/bitcoinjs-lib@asoltys/liquidjs-lib@antchain/mychainartbytejs-libarisejsarkjs@33cn/wallet-base@abcpros/xpi-js@abcpros/bch-jsabbc-libaliasqui@secux/app-xrp@secux/app-btc@simplioofficial/utxo-lib-modified@thismr/bitmindtest-core@williamqin-bitgo/bitcoinjs-lib@williamqin-bitgo/dogecoinjs-lib@odin/odinjs-lib@panaceacoin/panacea-js@zalastax/nolb-bipaudaxjs-libhsmrn-bitcoinjs-lib@bcpros/bitcoincashjs-lib@bcpros/xpi-jshtmlcoin-ethers-wrapperbbqpool-utxo-libbeyondcoinjsbgoldjs-libbgoldjs-lib-bitatbcoinjs-libbalanceofsatoshis@bitcoin-dot-com/bitcoincashjs2-lib@bithereum/bethjs-lib@bithighlander/bitcoin-cash-js-libbcorejsbbx-sdk-fixesbch-js-reg@btcd.io/bitcoinjs-libbitgo-utxo-lib@chris.troutner/bch-js@chris.troutner/bitbox-jsbitbox-lightbitbox-sdkbirkeland_bosbitcoincashjs-libbitcoincashjs-lib-p2shbpljsblockbirdcustom-icon-sdk-jsmachinecoinjs-libmetaverse-tsm25-transaction-utilslitecoinjslitecoinposjs-libodinjs-libkafirchain-tetriskapujskaan-bitcoinjs-lib@caravan/bitcoinbcc-bitcoinjs-libmw-bitgo-utxo-libmulticoinjs-libmonetaryunitjs-libdivijs-libltc-bitcoinjs-libpanacea-jsphantomjscoreqitmeer-jsyouchainjs-txyentenjs-libxec-jsxrg-jsbitbox-sdk-regtestuload-bitcoinjs-libunchained-bitcoinunihashjs-libvisio-js-libvisiocoin-js-lib@runonflux/utxo-lib@oipwg/bitcoinjs-lib@sambo5000/xec-js@samrock5000/xecjs@samrock5000/bch-js@trezor/utxo-lib
1.1.5

7 years ago

1.1.4

8 years ago

1.1.3

8 years ago

1.1.2

8 years ago

1.1.0

9 years ago

1.0.10

9 years ago

1.0.9

9 years ago

1.0.8

9 years ago

1.0.7

9 years ago

1.0.6

9 years ago

1.0.5

9 years ago

1.0.4

9 years ago

1.0.3

9 years ago

1.0.2

9 years ago

1.0.1

9 years ago

1.0.0

9 years ago