sis

package
v0.15.0 Latest Latest
Warning

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

Go to latest
Published: Jan 21, 2025 License: Apache-2.0 Imports: 9 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ElementIterator added in v0.15.0

type ElementIterator interface {
	Next() (fr.Element, bool)
}

ElementIterator is an iterator over a stream of field elements.

type LimbIterator added in v0.15.0

type LimbIterator struct {
	// contains filtered or unexported fields
}

LimbIterator iterates over a stream of field elements, limb by limb.

func NewLimbIterator added in v0.15.0

func NewLimbIterator(it ElementIterator, limbSize int) *LimbIterator

NewLimbIterator creates a new LimbIterator it is an iterator over a stream of field elements The elements are interpreted in little endian. The limb is also in little endian.

func (*LimbIterator) NextLimb added in v0.15.0

func (vr *LimbIterator) NextLimb() (uint64, bool)

NextLimb returns the next limb of the vector.

func (*LimbIterator) Reset added in v0.15.0

func (vr *LimbIterator) Reset(it ElementIterator)

Reset resets the iterator with a new ElementIterator.

type RSis

type RSis struct {
	// Vectors in ℤ_{p}/Xⁿ+1
	// A[i] is the i-th polynomial.
	// Ag the evaluation form of the polynomials in A on the coset √(g) * <g>
	A  [][]fr.Element
	Ag [][]fr.Element

	// LogTwoBound (Infinity norm) of the vector to hash. It means that each component in m
	// is < 2^B, where m is the vector to hash (the hash being A*m).
	// cf https://hackmd.io/7OODKWQZRRW9RxM5BaXtIw , B >= 3.
	LogTwoBound int

	// d, the degree of X^{d}+1
	Degree int

	// domain for the polynomial multiplication
	Domain *fft.Domain
	// contains filtered or unexported fields
}

RSis is the Ring-SIS instance

func NewRSis

func NewRSis(seed int64, logTwoDegree, logTwoBound, maxNbElementsToHash int) (*RSis, error)

NewRSis creates an instance of RSis. seed: seed for the randomness for generating A. logTwoDegree: if d := logTwoDegree, the ring will be ℤ_{p}[X]/Xᵈ-1, where X^{2ᵈ} is the 2ᵈ⁺¹-th cyclotomic polynomial logTwoBound: the bound of the vector to hash (using the infinity norm). maxNbElementsToHash: maximum number of field elements the instance handles used to derived n, the number of polynomials in A, and max size of instance's internal buffer.

func (*RSis) Hash added in v0.15.0

func (r *RSis) Hash(v, res []fr.Element) error

Hash interprets the input vector as a sequence of coefficients of size r.LogTwoBound bits long, and return the hash of the polynomial corresponding to the sum sum_i A[i]*m Mod X^{d}+1

func (*RSis) InnerHash added in v0.15.0

func (r *RSis) InnerHash(it *LimbIterator, res, k, kz fr.Vector, polId int, mask uint64)

InnerHash computes the inner hash of the polynomial corresponding to the i-th polynomial in A. It accumulates the result in res. It does not reduce mod Xᵈ+1. res, k, kz must have size r.Degree. kz is a buffer of zeroes used to zeroize the limbs buffer faster. mask is used to select the FFT to use when the FFT is unrolled.

type VectorIterator added in v0.15.0

type VectorIterator struct {
	// contains filtered or unexported fields
}

VectorIterator iterates over a vector of field element.

func NewVectorIterator added in v0.15.0

func NewVectorIterator(v fr.Vector) *VectorIterator

NewVectorIterator creates a new VectorIterator

func (*VectorIterator) Next added in v0.15.0

func (vi *VectorIterator) Next() (fr.Element, bool)

Next returns the next element of the vector.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳