integration: annotate the shared secret

This commit is contained in:
Daniel Cousens 2015-08-19 15:00:06 +10:00
parent b56bbce472
commit 00dad84880

View file

@ -15,7 +15,7 @@ describe('bitcoinjs-lib (crypto)', function () {
function stealthSend (Q) { function stealthSend (Q) {
var noncePair = bitcoin.ECPair.makeRandom() var noncePair = bitcoin.ECPair.makeRandom()
var e = noncePair.d var e = noncePair.d
var eQ = Q.multiply(e) var eQ = Q.multiply(e) // shared secret
var c = bigi.fromBuffer(bitcoin.crypto.sha256(eQ.getEncoded())) var c = bigi.fromBuffer(bitcoin.crypto.sha256(eQ.getEncoded()))
var cG = G.multiply(c) var cG = G.multiply(c)
var Qprime = Q.add(cG) var Qprime = Q.add(cG)
@ -27,7 +27,7 @@ describe('bitcoinjs-lib (crypto)', function () {
} }
function stealthReceive (d, P) { function stealthReceive (d, P) {
var dP = P.multiply(d) var dP = P.multiply(d) // shared secret
var c = bigi.fromBuffer(bitcoin.crypto.sha256(dP.getEncoded())) var c = bigi.fromBuffer(bitcoin.crypto.sha256(dP.getEncoded()))
var derived = new bitcoin.ECPair(d.add(c).mod(n)) var derived = new bitcoin.ECPair(d.add(c).mod(n))