ringsis

package
v0.0.0-...-4af87b5 Latest Latest
Warning

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

Go to latest
Published: Nov 6, 2024 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// The seed of the ring sis key
	RING_SIS_SEED int64 = 42069
)

Variables

View Source
var StdParams = Params{LogTwoBound: 16, LogTwoDegree: 6}

Standard parameter that we use for ring-SIS they are benchmarked at achieve more than the 128 level of security.

Functions

This section is empty.

Types

type Key

type Key struct {

	// Params provides the parameters of the ring-SIS instance (logTwoBound,
	// degree etc)
	Params
	// contains filtered or unexported fields
}

Key encapsulates the public parameters of an instance of the ring-SIS hash instance.

func GenerateKey

func GenerateKey(params Params, maxNumFieldToHash int) Key

GenerateKey generates a ring-SIS key from a set of a Params and a max number of elements to hash

func (*Key) Ag

func (s *Key) Ag() [][]field.Element

Ag returns the SIS key

func (*Key) CopyWithFreshBuffer

func (s *Key) CopyWithFreshBuffer() *Key

CopyWithFreshBuffer creates a copy of the key with fresh buffers. Shallow copies the the key itself.

func (*Key) FlattenedKey

func (s *Key) FlattenedKey() []field.Element

FlattenedKey returns the SIS key multiplied by RInv and laid out in a single-vector of field elements. This function is meant to be used as part of the self-recursion of Vortex and serves constructing an assignment for the column storing the chunks of the SIS key.

The function stores the key polynomial per polynomials. In coefficient form and multiplied by RInv so that it can account for the "Montgommery skip". See Key.Hash for more details.

func (*Key) Hash

func (s *Key) Hash(v []field.Element) []field.Element

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

It is equivalent to calling r.Write(element.Marshal()); outBytes = r.Sum(nil);

func (Key) HashModXnMinus1

func (s Key) HashModXnMinus1(limbs []field.Element) []field.Element

HashModXnMinus1 applies the SIS hash modulo X^n - 1, (instead of X^n + 1). This is used as part of the self-recursion procedure. Note that this **does not implement** a collision-resistant hash function and it is meant to. Its purpose is to help constructing a witness for the correctness of computation of a batch of SIS hashes.

The vector of limbs has to be provided in Montgommery form.

func (*Key) LimbSplit

func (s *Key) LimbSplit(vReg []field.Element) []field.Element

LimbSplit breaks down the entries of `v` into short limbs representing `LogTwoBound` bits each. The function then flatten and flatten them in a vector, casted as field elements in Montgommery form.

func (*Key) MaxNumFieldHashable

func (key *Key) MaxNumFieldHashable() int

MaxNumFieldHashable returns a positive integer indicating how many field elements can be provided to the hasher together at once in a single hash.

func (*Key) TransversalHash

func (s *Key) TransversalHash(v []smartvectors.SmartVector) []field.Element

TransversalHash evaluates SIS hashes transversally over a list of smart-vectors. Each smart-vector is seen as the row of a matrix. All rows must have the same size or panic. The function returns the hash of the columns. The column hashes are concatenated into a single array.

The function is optimize to deal with the ring-SIS instances parametrized by

  • modulus degree: 64 log2(bound): 8
  • modulus degree: 64 log2(bound): 16
  • modulus degree: 32 log2(bound): 8

type Params

type Params struct {
	LogTwoBound, LogTwoDegree int
}

Params encapsulates the parameters of a ring SIS instance

func (*Params) NumLimbs

func (p *Params) NumLimbs() int

NumLimbs number of limbs to represent a field element with the current representation

func (*Params) OutputSize

func (p *Params) OutputSize() int

Returns the number of field element composing the output. This coincides with the degree of the modulus polynomial characterizing the ring in which we instantiate ring-SIS.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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