package p384

import "github.com/cloudflare/circl/ecc/p384"

Package p384 provides optimized elliptic curve operations on the P-384 curve.

These are some improvements over crypto/elliptic package:

Example (P384)

Code:play 

package main

import (
	"crypto/elliptic"
	"crypto/rand"
	"fmt"

	"github.com/cloudflare/circl/ecc/p384"
)

func main() {
	// import "github.com/cloudflare/circl/ecc/p384"
	// import "crypto/elliptic"
	circl := p384.P384()
	stdlib := elliptic.P384()

	params := circl.Params()
	K, _ := rand.Int(rand.Reader, params.N)
	k := K.Bytes()

	x1, y1 := circl.ScalarBaseMult(k)
	x2, y2 := stdlib.ScalarBaseMult(k)
	fmt.Printf("%v, %v", x1.Cmp(x2) == 0, y1.Cmp(y2) == 0)
}

Output:

true, true

Index

Examples

Types

type Curve

type Curve interface {
	elliptic.Curve
	// IsAtInfinity returns True is the point is the identity point.
	IsAtInfinity(X, Y *big.Int) bool
	// CombinedMult calculates P=mG+nQ, where G is the generator and
	// Q=(Qx,Qy). The scalars m and n are positive integers in big-endian form.
	// Runs in non-constant time to be used in signature verification.
	CombinedMult(Qx, Qy *big.Int, m, n []byte) (Px, Py *big.Int)
}

Curve is used to provide the extended functionality and performance of elliptic.Curve interface.

func P384

func P384() Curve

P384 returns a Curve which implements P-384 (see FIPS 186-3, section D.2.4).

Source Files

arith.go arith_amd64.go doc.go p384.go p384opt.go point.go tableBase.go

Version
v1.6.1 (latest)
Published
Apr 9, 2025
Platform
linux/amd64
Imports
7 packages
Last checked
3 days ago

Tools for package owners.