base58: minor.
This commit is contained in:
parent
f3b7aee6fe
commit
4af5ba2574
@ -157,7 +157,7 @@ utils.toBase58 = function toBase58(buf) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
i = size - length;
|
i = size - length;
|
||||||
while (b58[i] === 0)
|
while (i < b58.length && b58[i] === 0)
|
||||||
i++;
|
i++;
|
||||||
|
|
||||||
for (j = 0; j < zeroes; j++)
|
for (j = 0; j < zeroes; j++)
|
||||||
@ -199,7 +199,7 @@ utils.fromBase58 = function fromBase58(str) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
i = 0;
|
i = 0;
|
||||||
while (b256[i] === 0)
|
while (i < b256.length && b256[i] === 0)
|
||||||
i++;
|
i++;
|
||||||
|
|
||||||
out = new Buffer(zeroes + (b256.length - i));
|
out = new Buffer(zeroes + (b256.length - i));
|
||||||
@ -207,8 +207,8 @@ utils.fromBase58 = function fromBase58(str) {
|
|||||||
for (j = 0; j < zeroes; j++)
|
for (j = 0; j < zeroes; j++)
|
||||||
out[j] = 0;
|
out[j] = 0;
|
||||||
|
|
||||||
for (; i < b256.length; i++)
|
while (i < b256.length)
|
||||||
out[i] = b256[i];
|
out[j++] = b256[i++];
|
||||||
|
|
||||||
return out;
|
return out;
|
||||||
};
|
};
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user