An Introduction to “White Paper 42” — Secret Value Distribution

// per WP042, generates a shared secret using Alice's private key and Bob's public key 
// shared secret can be x or y
import "github.com/libsv/go-bk/bec"func SharedSecret(privKeyA *bec.PrivateKey, pubKeyB *bec.PublicKey) ([]byte, []byte) {
curve := bec.S256()
x, y := curve.ScalarMult(pubKeyB.X, pubKeyB.Y, privKeyA.D.Bytes())
return x.Bytes(), y.Bytes()
}

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Murray Distributed Technologies

Murray Distributed Technologies

Building the future of online reviews powered by blockchain technology at britevue.com