util

package
v0.0.0-...-27b77c7 Latest Latest
Warning

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

Go to latest
Published: Feb 13, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const Q = 12289 //Q = 12*1024 + 1  (Q is the integer modulus which is used in Falcon.)

Variables

This section is empty.

Functions

func AllZeroes

func AllZeroes(numbers []int) bool

AllZeroes takes a slice of integers and returns true if all the elements of the slice are 0

func AnyZeroes

func AnyZeroes(numbers []int16) bool

func BigIntSliceEqual

func BigIntSliceEqual(a, b []*big.Int) bool

BigIntSliceEqual returns true if the slices a and b have the same length and contain the same elements.

func BigIntToInt16

func BigIntToInt16(x []*big.Int) []int16

func BiggestFloat64

func BiggestFloat64(f []float64) float64

func CmpBigInt

func CmpBigInt(x *big.Int, y *big.Int) bool

CmpBigInt compares x and y and returns true if both are equal

func CmpMaxFromBigInt

func CmpMaxFromBigInt(x *big.Int, y *big.Int) *big.Int

MaxFromBigNum compares x and y and returns the biggest one of them

func CmpMinFromBigInt

func CmpMinFromBigInt(x *big.Int, y *big.Int) *big.Int

MinFromBigNum compares x and y and returns the smallest one of them

func ComplexRealToFloat64

func ComplexRealToFloat64(c []complex128) []float64

func FillBigIntSlice

func FillBigIntSlice(s []*big.Int)

func that fill a slice with bn.SetInt64(0)

func Float64ToComplexReal

func Float64ToComplexReal(f []float64) []complex128

func Float64ToInt16

func Float64ToInt16(f []float64) []int16

func GenerateRandSalt

func GenerateRandSalt() []byte

GenerateRandSalt generates a random salt of length SaltLen. each bit has a 50% chance of being 0 or 1.

func Int16ToBigInt

func Int16ToBigInt(s []int16) []*big.Int

func that will take int16 slice and return big.Int slice

func Int16ToFloat64

func Int16ToFloat64(f []int16) []float64

func Int8ToFloat64

func Int8ToFloat64(f []int8) []float64

func IntToBigInt

func IntToBigInt(s []int) []*big.Int

func IntToInt16

func IntToInt16(s []int) []int16

func Max

func Max(a ...int) int

Max takes variadic number of int's and returns the biggest one of them

func MaxFromBigInt

func MaxFromBigInt(x []*big.Int) *big.Int

MaxFromBigNum returns the biggest one of them

func MergePolysInt

func MergePolysInt(f0, f1 []int16) []int16

Merge two polynomials into a single polynomial f

func MergePolysfloat64

func MergePolysfloat64(f0, f1 []float64) []float64

Merge two polynomials into a single polynomial f

func Min

func Min(a float64, b float64) float64

Min compares x and y and returns the smallest one of them

func MinFromBigInt

func MinFromBigInt(x []*big.Int) *big.Int

MinFromBigNum returns the smallest one of them

func NegFloat64

func NegFloat64(x []float64) []float64

func NegInt16

func NegInt16(x []int16) []int16

func Pmod

func Pmod(x, b int) int

Positive modulo, returns non negative solution to x % b

func RandElement

func RandElement(elements []int) int

func RandomBytes

func RandomBytes(data []byte) error

RandomBytes fills the given byte slice with random bytes.

func RandomFft

func RandomFft() float64

RandomFft generates a random number in range [-3, 4]

func RandomHexString

func RandomHexString(length int) string

RandomHexString generates a hex string with fixed length

func RoundAll

func RoundAll(numbers []float64) []int

func SmallestFloat64

func SmallestFloat64(f []float64) float64

func SplitPolysFloat64

func SplitPolysFloat64(f []float64) ([]float64, []float64)

Split a polynomial f in two polynomials.

func SplitPolysInt

func SplitPolysInt(f []int16) ([]int16, []int16)

Split a polynomial f in two polynomials.

func Sqnorm

func Sqnorm(v [][]float64) float64

Sqnorm compute the square euclidean norm of the vector v.

func SquareInt16

func SquareInt16(x int16) int16

func SubFloat64

func SubFloat64(x []float64, y []float64) []float64

func SubInt16

func SubInt16(x []int16, y []int16) []int16

func UintFromBytes

func UintFromBytes(b []byte) uint64

Types

This section is empty.

Jump to

Keyboard shortcuts

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