Corrected encoded form with correct padding. See #1.

This commit is contained in:
Stefan Thomas 2011-09-27 13:44:47 +01:00
parent 8719d925d6
commit d7ce1e5db8

View file

@ -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;
};