Documentation ¶
Index ¶
- Constants
- Variables
- type Key
- func (s *Key) Ag() [][]field.Element
- func (s *Key) CopyWithFreshBuffer() *Key
- func (s *Key) FlattenedKey() []field.Element
- func (s *Key) Hash(v []field.Element) []field.Element
- func (s Key) HashModXnMinus1(limbs []field.Element) []field.Element
- func (s *Key) LimbSplit(vReg []field.Element) []field.Element
- func (key *Key) MaxNumFieldHashable() int
- func (s *Key) TransversalHash(v []smartvectors.SmartVector) []field.Element
- type Params
Constants ¶
const ( // The seed of the ring sis key RING_SIS_SEED int64 = 42069 )
Variables ¶
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 ¶
GenerateKey generates a ring-SIS key from a set of a Params and a max number of elements to hash
func (*Key) CopyWithFreshBuffer ¶
CopyWithFreshBuffer creates a copy of the key with fresh buffers. Shallow copies the the key itself.
func (*Key) FlattenedKey ¶
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 ¶
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 ¶
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 ¶
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 ¶
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 ¶
NumLimbs number of limbs to represent a field element with the current representation
func (*Params) OutputSize ¶
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.