Browse Source

Fix parsing of base58 compressed private keys. Add base64 parse support.

Signed-off-by: Michael Gooden <me@michaelgooden.net>
hk-custom-address
Michael Gooden 11 years ago
parent
commit
b3e3f806cb
No known key found for this signature in database GPG Key ID: 909C1E1B489AD6BC
  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())
: util.isArray(input) ? fromBin(input.slice(0,32))
: typeof input != "string" ? null
: input.length == 44 ? fromBin(conv.base64ToBytes(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)))
: null
@ -41,6 +42,7 @@ ECKey.prototype.import = function (input,compressed) {
: input instanceof BigInteger ? false
: util.isArray(input) ? false
: typeof input != "string" ? null
: input.length == 44 ? false
: input.length == 51 && input[0] == '5' ? false
: input.length == 52 && has('LK',input[0]) ? true
: input.length == 64 ? false

Loading…
Cancel
Save