stealth: d is not involved in the receiver private key
This commit is contained in:
parent
b4062d56d1
commit
6f47bc4d70
1 changed files with 6 additions and 6 deletions
|
@ -37,30 +37,30 @@ function stealthRecoverLeaked (v, e, Q) {
|
||||||
return d
|
return d
|
||||||
}
|
}
|
||||||
|
|
||||||
// vG = (rG * (dG * sha256(e * dG)G))
|
// vG = (rG * sha256(e * dG)G)
|
||||||
function stealthDualSend (e, R, Q) {
|
function stealthDualSend (e, R, Q) {
|
||||||
var eQ = Q.multiply(e) // shared secret
|
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 vG = new bitcoin.ECPair(null, R.add(Q.add(cG)))
|
var vG = new bitcoin.ECPair(null, R.add(cG))
|
||||||
|
|
||||||
return vG
|
return vG
|
||||||
}
|
}
|
||||||
|
|
||||||
// vG = (rG * (d + sha256(eG * d))G)
|
// vG = (rG * sha256(eG * d)G)
|
||||||
function stealthDualScan (d, R, eG) {
|
function stealthDualScan (d, R, eG) {
|
||||||
var eQ = eG.multiply(d) // shared secret
|
var eQ = eG.multiply(d) // shared secret
|
||||||
var c = bigi.fromBuffer(bitcoin.crypto.sha256(eQ.getEncoded()))
|
var c = bigi.fromBuffer(bitcoin.crypto.sha256(eQ.getEncoded()))
|
||||||
var vG = new bitcoin.ECPair(null, R.add(G.multiply(d.add(c).mod(n))))
|
var vG = new bitcoin.ECPair(null, R.add(G.multiply(c)))
|
||||||
|
|
||||||
return vG
|
return vG
|
||||||
}
|
}
|
||||||
|
|
||||||
// v = (r + d + sha256(eG * d))
|
// v = (r + sha256(eG * d))
|
||||||
function stealthDualReceive (d, r, eG) {
|
function stealthDualReceive (d, r, eG) {
|
||||||
var eQ = eG.multiply(d) // shared secret
|
var eQ = eG.multiply(d) // shared secret
|
||||||
var c = bigi.fromBuffer(bitcoin.crypto.sha256(eQ.getEncoded()))
|
var c = bigi.fromBuffer(bitcoin.crypto.sha256(eQ.getEncoded()))
|
||||||
var v = new bitcoin.ECPair(r.add(d).add(c).mod(n))
|
var v = new bitcoin.ECPair(r.add(c).mod(n))
|
||||||
|
|
||||||
return v
|
return v
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue