Source File
ecdh.go
Belonging Package
github.com/decred/dcrd/dcrec/secp256k1/v4
// Copyright (c) 2015 The btcsuite developers// Copyright (c) 2015-2023 The Decred developers// Use of this source code is governed by an ISC// license that can be found in the LICENSE file.package secp256k1// GenerateSharedSecret generates a shared secret based on a private key and a// public key using Diffie-Hellman key exchange (ECDH) (RFC 5903).// RFC5903 Section 9 states we should only return x.//// It is recommended to securely hash the result before using as a cryptographic// key.func ( *PrivateKey, *PublicKey) []byte {var , JacobianPoint.AsJacobian(&)ScalarMultNonConst(&.Key, &, &).ToAffine():= .X.Bytes()return [:]}
![]() |
The pages are generated with Golds v0.8.2. (GOOS=linux GOARCH=amd64) Golds is a Go 101 project developed by Tapir Liu. PR and bug reports are welcome and can be submitted to the issue list. Please follow @zigo_101 (reachable from the left QR code) to get the latest news of Golds. |