curve25519

package
v0.0.0-...-a0974a4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 10, 2023 License: BSD-3-Clause Imports: 4 Imported by: 0

Documentation

Overview

Package curve25519 provides an implementation of the X25519 function, which performs scalar multiplication on the elliptic curve known as Curve25519. See RFC 7748.

Index

Constants

View Source
const (
	// ScalarSize is the size of the scalar input to X25519.
	ScalarSize = 32
	// PointSize is the size of the point input to X25519.
	PointSize = 32
)

Variables

View Source
var Basepoint []byte

Basepoint is the canonical Curve25519 generator.

Functions

func ScalarBaseMult

func ScalarBaseMult(dst, scalar *[32]byte)

ScalarBaseMult sets dst to the product scalar * base where base is the standard generator.

It is recommended to use the X25519 function with Basepoint instead, as copying into fixed size arrays can lead to unexpected bugs.

func ScalarMult deprecated

func ScalarMult(dst, scalar, point *[32]byte)

ScalarMult sets dst to the product scalar * point.

Deprecated: when provided a low-order point, ScalarMult will set dst to all zeroes, irrespective of the scalar. Instead, use the X25519 function, which will return an error.

func X25519

func X25519(scalar, point []byte) ([]byte, error)

X25519 returns the result of the scalar multiplication (scalar * point), according to RFC 7748, Section 5. scalar, point and the return value are slices of 32 bytes.

scalar can be generated at random, for example with crypto/rand. point should be either Basepoint or the output of another X25519 call.

If point is Basepoint (but not if it's a different slice with the same contents) a precomputed implementation might be used for performance.

Types

This section is empty.

Directories

Path Synopsis
internal
field
Package field implements fast arithmetic modulo 2^255-19.
Package field implements fast arithmetic modulo 2^255-19.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL