Browse Source

Changes indentation to 2 spaces

hk-custom-address
Daniel Cousens 11 years ago
parent
commit
f8de9a66da
  1. 9
      src/base58.js

9
src/base58.js

@ -26,6 +26,7 @@ function encode(input) {
chars.push(alphabet[mod.intValue()]);
bi = bi.subtract(mod).divide(base);
}
chars.push(alphabet[bi.intValue()]);
// Convert leading zeros too.
@ -42,7 +43,6 @@ function encode(input) {
// input should be a base58 encoded string
// @return Array
function decode(input) {
var base = BigInteger.valueOf(58);
var length = input.length;
@ -80,7 +80,8 @@ function decode(input) {
function checkEncode(input, vbyte) {
vbyte = vbyte || 0;
var front = [vbyte].concat(input)
var front = [vbyte].concat(input);
return encode(front.concat(getChecksum(front)));
}
@ -89,9 +90,9 @@ function checkDecode(input) {
front = bytes.slice(0,bytes.length-4),
back = bytes.slice(bytes.length-4);
var checksum = getChecksum(front)
var checksum = getChecksum(front);
if (""+checksum != ""+back) {
if ("" + checksum != "" + back) {
throw new Error("Checksum failed");
}

Loading…
Cancel
Save