p384

package
v0.0.0-...-ac9c40d Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2024 License: BSD-3-Clause, BSD-3-Clause Imports: 7 Imported by: 0

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 performed using a constant-time algorithm.
  • ScalarBaseMult fallbacks into ScalarMult.
  • A new method included for double-point multiplication.
Example (P384)
package main

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

	"github.com/JI-0/circl/ecc/p384"
)

func main() {
	// import "github.com/JI-0/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