// Copyright 2022 The Go Authors. All rights reserved.// Use of this source code is governed by a BSD-style// license that can be found in the LICENSE file.//go:build go1.20package curve25519importfunc x25519( *[32]byte, , []byte) ([]byte, error) { := ecdh.X25519() , := .NewPublicKey()if != nil {returnnil, } , := .NewPrivateKey()if != nil {returnnil, } , := .ECDH()if != nil {returnnil, }copy([:], )return [:], nil}func scalarMult(, , *[32]byte) {if , := x25519(, [:], [:]); != nil {// The only error condition for x25519 when the inputs are 32 bytes long // is if the output would have been the all-zero value.for := range { [] = 0 } }}func scalarBaseMult(, *[32]byte) { := ecdh.X25519() , := .NewPrivateKey([:])if != nil {panic("curve25519: internal error: scalarBaseMult was not 32 bytes") }copy([:], .PublicKey().Bytes())}
The pages are generated with Goldsv0.6.7. (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 @Go100and1 (reachable from the left QR code) to get the latest news of Golds.