Browse Source

Merge pull request #1 from MichaelGooden/hotfix/compressed-priv-keys

Fix parsing of base58 compressed private keys. Add base64 parse support.
hk-custom-address
Kyle Drake 11 years ago
parent
commit
932b6bce70
  1. 7
      bitcoinjs-min.js
  2. 4
      src/eckey.js

7
bitcoinjs-min.js

File diff suppressed because one or more lines are too long

4
src/eckey.js

@ -30,8 +30,9 @@ ECKey.prototype.import = function (input,compressed) {
: input instanceof BigInteger ? input.mod(ecparams.getN()) : input instanceof BigInteger ? input.mod(ecparams.getN())
: util.isArray(input) ? fromBin(input.slice(0,32)) : util.isArray(input) ? fromBin(input.slice(0,32))
: typeof input != "string" ? null : typeof input != "string" ? null
: input.length == 44 ? fromBin(conv.base64ToBytes(input))
: input.length == 51 && input[0] == '5' ? fromBin(base58.checkDecode(input)) : input.length == 51 && input[0] == '5' ? fromBin(base58.checkDecode(input))
: input.length == 52 && has('LK',input[0]) ? fromBin(base58.checkDecode(input)) : input.length == 52 && has('LK',input[0]) ? fromBin(base58.checkDecode(input).slice(0,32))
: has([64,65],input.length) ? fromBin(conv.hexToBytes(input.slice(0,64))) : has([64,65],input.length) ? fromBin(conv.hexToBytes(input.slice(0,64)))
: null : null
@ -41,6 +42,7 @@ ECKey.prototype.import = function (input,compressed) {
: input instanceof BigInteger ? false : input instanceof BigInteger ? false
: util.isArray(input) ? false : util.isArray(input) ? false
: typeof input != "string" ? null : typeof input != "string" ? null
: input.length == 44 ? false
: input.length == 51 && input[0] == '5' ? false : input.length == 51 && input[0] == '5' ? false
: input.length == 52 && has('LK',input[0]) ? true : input.length == 52 && has('LK',input[0]) ? true
: input.length == 64 ? false : input.length == 64 ? false

Loading…
Cancel
Save