INNER CODE UNIT · Go
computeBlindingFactor
lightningnetwork/lightning-onion · crypto.go:167
func computeBlindingFactor(hopPubKey *btcec.PublicKey,
hopSharedSecret []byte) btcec.ModNScalar {
sha := sha256.New()
sha.Write(hopPubKey.SerializeCompressed())
sha.Write(hopSharedSecret)
var hash Hash256
copy(hash[:], sha.Sum(nil))
var blindingBytes btcec.ModNScalar
blindingBytes.SetByteSlice(hash[:])
return blindingBytes
}
// blindGroupElement blinds the group element P by performing scalar
// multiplication of the group element by blindingFactor: blindingFactor * P.