Browse Source

Changes indentation to 2 spaces

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

7
src/base58.js

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

Loading…
Cancel
Save