mapping

package
v0.0.0-...-88e0eed Latest Latest
Warning

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

Go to latest
Published: Mar 17, 2020 License: BSD-3-Clause Imports: 5 Imported by: 0

Documentation

Overview

Package mapping contains a set of functions to construct functions that take a field element and return a point on an elliptic curve. Certain mappings restrict the form of the curve or its parameters.

Choosing a mapping function

If the target elliptic curve is:

  • a supersingular curve, then use either the Boneh-Franklin method (NewBF) or the Elligator 2 method for A == 0 (newWA0Ell2);
  • a Montgomery or twisted Edwards curve, then use the Elligator 2 (NewElligator2);
  • a Weierstrass curve, then use either the Simplified SWU (NewSSWU), even if either A or B is zero;
  • if none of the above applies, then use the Shallue-van de Woestijne method (NewSVDW).

Note: the mappings must not be used standalone, since its correct and secure usage is determined by each hash to curve suite.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ID

type ID uint

ID is an identifier of a mapping.

const (
	// BF is the Boneh-Franklin method
	BF ID = iota
	// SSWU is the Simplified SWU method.
	SSWU
	// ELL2 is Elligator2 method for Montgomery curves.
	ELL2
	// EDELL2 is Elligator2 method for twisted Edwards curves.
	EDELL2
	// SVDW is Shallue-van de Woestijne method.
	SVDW
)

func (ID) Get

func (id ID) Get(e C.EllCurve, z GF.Elt, sgn0 GF.Sgn0ID, iso func() C.Isogeny) MapToCurve

Get returns a MapToCurve implementation based on ID provided. Some arguments can be set to nil if there are not required by the mapping.

type MapToCurve

type MapToCurve interface {
	Map(GF.Elt) C.Point
}

MapToCurve maps a field element into a elliptic curve point.

func NewBF

func NewBF(e C.EllCurve) MapToCurve

NewBF implements the Boneh-Franklin method.

func NewElligator2

func NewElligator2(e C.EllCurve, sgn0 GF.Sgn0ID) MapToCurve

NewElligator2 implements the Elligator2 method.

func NewSSWU

func NewSSWU(e C.EllCurve, z GF.Elt, sgn0 GF.Sgn0ID, iso func() C.Isogeny) MapToCurve

NewSSWU implements the Simplified SWU method. If a non-nil isogeny (e0 -> e) is provided, it first maps points to e0 and then applies the isogeny to get a point on e.

func NewSVDW

func NewSVDW(e C.EllCurve, sgn0 GF.Sgn0ID) MapToCurve

NewSVDW implements the Shallue-van de Woestijne method.

Jump to

Keyboard shortcuts

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