integration: annotate the shared secret
This commit is contained in:
parent
b56bbce472
commit
00dad84880
1 changed files with 2 additions and 2 deletions
|
@ -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))
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue