Skip to content

Commit

Permalink
Apply fix from #131 and maintain a backwards compatibility trapdoor.
Browse files Browse the repository at this point in the history
  • Loading branch information
caedesvvv committed May 28, 2014
1 parent 84b3feb commit da6a084
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion js/util/stealth.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ Stealth.testnet = 43;
// Can these be different in the future?
Stealth.nonceVersion = 6;

// Backwards compatibility quirk (0.4.0)
Stealth.quirk = false

/*
* Create a bitcoin key with just public component.
* @param {Object} Q public key as bytes
Expand All @@ -39,7 +42,12 @@ Stealth.stealthDH = function(e, decKey) {
var point = decKey.pub.multiply(e);

// start the second stage
var S1 = [3].concat(point.getX().toBigInteger().toByteArrayUnsigned());
var S1;
if (Stealth.quirk) {
S1 = [3].concat(point.getX().toBigInteger().toByteArrayUnsigned());
} else {
S1 = point.getEncoded(true);
}
var c = convert.wordArrayToBytes(Bitcoin.CryptoJS.SHA256(convert.bytesToWordArray(S1)));
return c;
};
Expand Down

0 comments on commit da6a084

Please sign in to comment.