utils

package
v0.3.8 Latest Latest
Warning

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

Go to latest
Published: Feb 1, 2021 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExpandMsgXmd added in v0.3.4

func ExpandMsgXmd(msg, dst []byte, lenInBytes int) ([]byte, error)

ExpandMsgXmd expands msg to a slice of lenInBytes bytes. https://tools.ietf.org/html/draft-irtf-cfrg-hash-to-curve-06#section-5 https://tools.ietf.org/html/rfc8017#section-4.1 (I2OSP/O2ISP)

func NafDecomposition

func NafDecomposition(a *big.Int, result []int8) int

NafDecomposition gets the naf decomposition of a big number

func PrecomputeLattice added in v0.3.0

func PrecomputeLattice(r, lambda *big.Int, res *Lattice)

PrecomputeLattice res such that res.V1, res.V2 are short vectors satisfying v11+v12lambda=v21+v22lambda=0[r]. cf https://www.iacr.org/archive/crypto2001/21390189.pdf

func SplitScalar added in v0.3.0

func SplitScalar(s *big.Int, l *Lattice) [2]big.Int

SplitScalar outputs u,v such that u+vlambda=s[r]. The method is to view s as (s,0) in ZxZ, and find a close vector w of (s,0) in <l>, where l is a sub Z-module of ker((a,b)->a+blambda[r]): then (u,v)=w-(s,0), and u+vlambda=s[r]. cf https://www.iacr.org/archive/crypto2001/21390189.pdf

Types

type Lattice added in v0.3.0

type Lattice struct {
	V1, V2 [2]big.Int
	Det    big.Int
}

Lattice represents a Z module spanned by V1, V2. det is the associated determinant.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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