From d7ce1e5db8ed1355aff94d799b4bb413451d4d62 Mon Sep 17 00:00:00 2001 From: Stefan Thomas Date: Tue, 27 Sep 2011 13:44:47 +0100 Subject: [PATCH] Corrected encoded form with correct padding. See #1. --- src/ecdsa.js | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/src/ecdsa.js b/src/ecdsa.js index 1f84456..1484620 100644 --- a/src/ecdsa.js +++ b/src/ecdsa.js @@ -18,13 +18,7 @@ ECPointFp.prototype.getEncoded = function (compressed) { var x = this.getX().toBigInteger(); var y = this.getY().toBigInteger(); - if (compressed) { - var PC; - } - - var len = this.getX().getByteLength(); - - var enc = integerToBytes(x, len); + var enc = integerToBytes(x, 32); if (compressed) { if (y.testBit(0)) { @@ -32,9 +26,10 @@ ECPointFp.prototype.getEncoded = function (compressed) { } else { enc.unshift(0x03); } + // TODO: Implement } else { enc.unshift(0x04); - enc = enc.concat(integerToBytes(y, len)); + enc = enc.concat(integerToBytes(y, 32)); } return enc; };