Determine whether key is compressed from the key itself. ref #61

This commit is contained in:
Andreas Brekken 2014-03-11 18:26:40 +01:00
parent 29ad6b692e
commit f09890fed1

View file

@ -27,7 +27,7 @@ Message.getHash = function (message) {
return Crypto.SHA256(Crypto.SHA256(buffer, {asBytes: true}), {asBytes: true});
};
Message.signMessage = function (key, message, compressed) {
Message.signMessage = function (key, message) {
var hash = Message.getHash(message);
var sig = key.sign(hash);
@ -37,7 +37,7 @@ Message.signMessage = function (key, message, compressed) {
var i = ecdsa.calcPubkeyRecoveryParam(key, obj.r, obj.s, hash);
i += 27;
if (compressed) i += 4;
if (key.compressed) i += 4;
var rBa = obj.r.toByteArrayUnsigned();
var sBa = obj.s.toByteArrayUnsigned();