sis

package
v0.10.1 Latest Latest
Warning

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

Go to latest
Published: Apr 2, 2023 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNotAPowerOfTwo = errors.New("d must be a power of 2")
)

Functions

func NewRingSISMaker

func NewRingSISMaker(seed int64, logTwoDegree, logTwoBound, maxNbElementsToHash int) (func() hash.Hash, error)

Construct a hasher generator. It takes as input the same parameters as `NewRingSIS` and outputs a function which returns fresh hasher everytime it is called

Types

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 (Inifinty 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

	// domain for the polynomial multiplication
	Domain *fft.Domain

	// d, the degree of X^{d}+1
	Degree int
	// contains filtered or unexported fields
}

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) BlockSize

func (r *RSis) BlockSize() int

BlockSize returns the hash's underlying block size. The Write method must be able to accept any amount of data, but it may operate more efficiently if all writes are a multiple of the block size.

func (*RSis) Reset

func (r *RSis) Reset()

Reset resets the Hash to its initial state.

func (*RSis) Size

func (r *RSis) Size() int

Size returns the number of bytes Sum will return.

func (*RSis) Sum

func (r *RSis) Sum(b []byte) []byte

Sum appends the current hash to b and returns the resulting slice. It does not change the underlying hash state. The instance buffer is interpreted as a sequence of coefficients of size r.Bound bits long. The function returns the hash of the polynomial as a a sequence []fr.Elements, interpreted as []bytes, corresponding to sum_i A[i]*m Mod X^{d}+1

func (*RSis) Write

func (r *RSis) Write(p []byte) (n int, err error)

Jump to

Keyboard shortcuts

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