fourq

package module
v0.0.0-...-8ada258 Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2017 License: BSD-3-Clause Imports: 2 Imported by: 0

README

FourQ

FourQ is a high-speed elliptic curve at the 128-bit security level. This package contains only an AMD64-optimized implementation. It is a preliminary implementation, and is incomplete. In particular, this package does not implement FourQ's endomorphisms or lattice reduction techniques.

Most recent benchmarks:

BenchmarkScalarBaseMult-4   	  200000	      7857 ns/op	     128 B/op	       1 allocs/op
BenchmarkScalarMult-4       	   50000	     38939 ns/op	     128 B/op	       1 allocs/op
BenchmarkScalarMultU-4      	   50000	     37112 ns/op	     128 B/op	       1 allocs/op

BenchmarkP256Base-4         	  100000	     16629 ns/op	     768 B/op	      12 allocs/op
BenchmarkP256-4             	   20000	     66726 ns/op	    2592 B/op	      16 allocs/op

BenchmarkCurve25519-4       	   30000	     47841 ns/op	       0 B/op	       0 allocs/op

Documentation

Overview

Package fourq implements FourQ, a high-speed elliptic curve at the 128-bit security level.

https://eprint.iacr.org/2015/565.pdf

Index

Constants

This section is empty.

Variables

View Source
var (
	Order, _ = new(big.Int).SetString("73846995687063900142583536357581573884798075859800097461294096333596429543", 10)

	// G is the compressed generator point.
	G = [32]byte{
		0x87, 0xb2, 0xcb, 0x2b, 0x46, 0xa2, 0x24, 0xb9,
		0x5a, 0x78, 0x20, 0xa1, 0x9b, 0xee, 0x3f, 0x0e,
		0x5c, 0x8b, 0x4c, 0x84, 0x44, 0xc3, 0xa7, 0x49,
		0x42, 0x02, 0x0e, 0x63, 0xf8, 0x4a, 0x1c, 0x6e,
	}

	// GU is the uncompressed generator point.
	GU = [64]byte{
		0xaa, 0x33, 0x38, 0x7b, 0xad, 0x92, 0x65, 0x28,
		0x05, 0xb3, 0x2f, 0x7c, 0x23, 0x72, 0x34, 0x1a,
		0xf6, 0x77, 0xac, 0x60, 0xb3, 0x9f, 0x86, 0x96,
		0x9c, 0xaa, 0x78, 0x28, 0x3f, 0x55, 0x1f, 0x1e,
		0x87, 0xb2, 0xcb, 0x2b, 0x46, 0xa2, 0x24, 0xb9,
		0x5a, 0x78, 0x20, 0xa1, 0x9b, 0xee, 0x3f, 0x0e,
		0x5c, 0x8b, 0x4c, 0x84, 0x44, 0xc3, 0xa7, 0x49,
		0x42, 0x02, 0x0e, 0x63, 0xf8, 0x4a, 0x1c, 0x6e,
	}
)

Functions

func IsOnCurve

func IsOnCurve(pt [32]byte) bool

IsOnCurve returns true if pt represents a compressed point on the curve (including the identity point and points in a non-prime order subgroup) and false otherwise.

func IsOnCurveU

func IsOnCurveU(pt [64]byte) bool

IsOnCurveU returns true if pt represents an uncompressed point on the curve.

func ScalarBaseMult

func ScalarBaseMult(k []byte) ([32]byte, bool)

ScalarBaseMult returns the generator multiplied by scalar k, compressed. k's slice should be 32 bytes long or shorter (or the function will return nil and false).

func ScalarBaseMultU

func ScalarBaseMultU(k []byte) ([64]byte, bool)

ScalarBaseMultU returns the generator multiplied by scalar k, uncompressed.

func ScalarMult

func ScalarMult(pt [32]byte, k []byte, clearCofactor bool) ([32]byte, bool)

ScalarMult returns the compressed point multiplied by scalar k. The function returns false if pt does not represent a point on the curve, of if the output is the identity point. When clearCofactor=true, it additionally returns false when pt is not in the prime-order subgroup.

func ScalarMultU

func ScalarMultU(pt [64]byte, k []byte, clearCofactor bool) ([64]byte, bool)

ScalarMultU returns the uncompressed point multiplied by scalar k.

Types

This section is empty.

Jump to

Keyboard shortcuts

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