p384

package
v1.6.5 Latest Latest
Warning

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

Go to latest
Published: Aug 5, 2026 License: BSD-3-Clause, BSD-3-Clause Imports: 7 Imported by: 11 modules, 7 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

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

These are some improvements over crypto/elliptic package:

  • Around 10x faster in amd64 architecture.
  • Reduced number of memory allocations.
  • Native support for arm64 architecture.
  • ScalarMult is not fully constant time (see note below).
  • ScalarBaseMult fallbacks into ScalarMult.
  • A new method included for double-point multiplication.

Note: the scalar-multiplication routines in this package are not fully constant time.

Example (P384)
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

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

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).

Jump to

Keyboard shortcuts

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