Source File
curve25519.go
Belonging Package
golang.org/x/crypto/curve25519
package curve25519 // import "golang.org/x/crypto/curve25519"
import (
)
func (, , *[32]byte) {
scalarMult(, , )
}
func (, *[32]byte) {
ScalarMult(, , &basePoint)
}
PointSize = 32
)
var Basepoint []byte
var basePoint = [32]byte{9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
func () { Basepoint = basePoint[:] }
func () {
if subtle.ConstantTimeCompare(Basepoint, []byte{
0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
}) != 1 {
panic("curve25519: global Basepoint value was modified")
}
}
var [32]byte
return x25519(&, , )
}
func ( *[32]byte, , []byte) ([]byte, error) {
var [32]byte
if := len(); != 32 {
return nil, fmt.Errorf("bad scalar length: %d, expected %d", , 32)
}
if := len(); != 32 {
return nil, fmt.Errorf("bad point length: %d, expected %d", , 32)
}
copy([:], )
if &[0] == &Basepoint[0] {
checkBasepoint()
ScalarBaseMult(, &)
} else {
var , [32]byte
copy([:], )
ScalarMult(, &, &)
if subtle.ConstantTimeCompare([:], [:]) == 1 {
return nil, fmt.Errorf("bad input point: low order point")
}
}
return [:], nil
![]() |
The pages are generated with Golds v0.3.2-preview. (GOOS=darwin 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. |