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/ReallyMeLabs/circl/ecc/p384"
)
func main() {
// import "github.com/ReallyMeLabs/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.
Click to show internal directories.
Click to hide internal directories.