summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTorben <torben.letorbi@gmail.com>2015-12-10 21:15:53 +0100
committerTorben <torben.letorbi@gmail.com>2015-12-10 21:15:53 +0100
commitf388fd7b6fe3595f714a9f4fd51665f122b7e30c (patch)
treeb40d058a27ef62970bb195b4a0fdb6dfe2e2b4dc
parent2e828715daa64fc4ea7be8fab7d341e64618206f (diff)
downloadsjcl-f388fd7b6fe3595f714a9f4fd51665f122b7e30c.zip
sjcl-f388fd7b6fe3595f714a9f4fd51665f122b7e30c.tar.gz
sjcl-f388fd7b6fe3595f714a9f4fd51665f122b7e30c.tar.bz2
Revert "Add leading-zero stripping option to big number toString method"
This reverts commit 2e828715daa64fc4ea7be8fab7d341e64618206f.
-rw-r--r--core/bn.js13
-rw-r--r--test/bn_test.js2
2 files changed, 6 insertions, 9 deletions
diff --git a/core/bn.js b/core/bn.js
index 181f125..4755f70 100644
--- a/core/bn.js
+++ b/core/bn.js
@@ -88,15 +88,12 @@ sjcl.bn.prototype = {
/**
* Convert to a hex string.
*/
- toString: function(doTrim) {
- var i, s, l, out = new sjcl.bn(this);
- out.fullReduce();
- doTrim && out.trim();
- l = out.limbs;
- out = "";
- for (i=0; i < l.length; i++) {
+ toString: function() {
+ this.fullReduce();
+ var out="", i, s, l = this.limbs;
+ for (i=0; i < this.limbs.length; i++) {
s = l[i].toString(16);
- while (i < l.length - 1 && s.length < 6) {
+ while (i < this.limbs.length - 1 && s.length < 6) {
s = "0" + s;
}
out = s + out;
diff --git a/test/bn_test.js b/test/bn_test.js
index 0f03554..a669991 100644
--- a/test/bn_test.js
+++ b/test/bn_test.js
@@ -72,7 +72,7 @@ new sjcl.test.TestCase("Bignum toString test", function (cb) {
cb && cb();
return;
}
- this.require((new sjcl.bn(12312434)).power(10).toString(true) ===
+ this.require((new sjcl.bn(12312434)).power(10).toString() ===
'0xb99c06973dcc72429aa1dd41b0bc40a424289a05d3d72f066ee4e71c400');
cb && cb();
});