montgomery

package
v0.0.0-...-375edae Latest Latest
Warning

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

Go to latest
Published: Sep 25, 2023 License: BSD-3-Clause Imports: 3 Imported by: 0

Documentation

Overview

Package montgomery provides helper routines for dealing with curve25519 montgomery points.

Index

Constants

This section is empty.

Variables

View Source
var (
	ZERO = new(field.Element).Zero()
	ONE  = new(field.Element).One()
	TWO  = new(field.Element).Add(ONE, ONE)

	A         = mustFeFromUint64(486662)
	A_SQUARED = mustFeFromUint64(486662 * 486662)

	SQRT_M1 = mustFeFromBytes([]byte{
		0xb0, 0xa0, 0x0e, 0x4a, 0x27, 0x1b, 0xee, 0xc4, 0x78, 0xe4, 0x2f, 0xad, 0x06, 0x18, 0x43, 0x2f,
		0xa7, 0xd7, 0xfb, 0x3d, 0x99, 0x00, 0x4d, 0x2b, 0x0b, 0xdf, 0xc1, 0x4f, 0x80, 0x24, 0x83, 0x2b,
	})

	NEG_A = mustFeFromBytes([]byte{
		0xe7, 0x92, 0xf8, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
		0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f,
	})

	SQRT_NEG_A_PLUS_TWO = mustFeFromBytes([]byte{
		0x06, 0x7e, 0x45, 0xff, 0xaa, 0x04, 0x6e, 0xcc, 0x82, 0x1a, 0x7d, 0x4b, 0xd1, 0xd3, 0xa1, 0xc5,
		0x7e, 0x4f, 0xfc, 0x03, 0xdc, 0x08, 0x7b, 0xd2, 0xbb, 0x06, 0xa0, 0x60, 0xf4, 0xed, 0x26, 0x0f,
	})

	U_FACTOR = mustFeFromBytes([]byte{
		0x8d, 0xbe, 0xe2, 0x6b, 0xb1, 0xc9, 0x23, 0x76, 0x0e, 0x37, 0xa0, 0xa5, 0xf2, 0xcf, 0x79, 0xa1,
		0xb1, 0x50, 0x08, 0x84, 0xcd, 0xfe, 0x65, 0xa9, 0xe9, 0x41, 0x7c, 0x60, 0xff, 0xb6, 0xf9, 0x28,
	})

	V_FACTOR = mustFeFromBytes([]byte{
		0x3e, 0x5f, 0xf1, 0xb5, 0xd8, 0xe4, 0x11, 0x3b, 0x87, 0x1b, 0xd0, 0x52, 0xf9, 0xe7, 0xbc, 0xd0,
		0x58, 0x28, 0x04, 0xc2, 0x66, 0xff, 0xb2, 0xd4, 0xf4, 0x20, 0x3e, 0xb0, 0x7f, 0xdb, 0x7c, 0x54,
	})
)

Functions

func FromEdwardsPoint

func FromEdwardsPoint(p *edwards25519.Point) (*field.Element, *field.Element)

func NewEdwardsFromXY

func NewEdwardsFromXY(x, y *field.Element) *edwards25519.Point

func ToEdwardsPoint

func ToEdwardsPoint(u, v *field.Element) *edwards25519.Point

Types

This section is empty.

Jump to

Keyboard shortcuts

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