utils

package
v0.0.0-...-79b6b6b Latest Latest
Warning

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

Go to latest
Published: Mar 2, 2022 License: Apache-2.0 Imports: 4 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ComputePadding

func ComputePadding(M, N uint32) (uint64, uint64)

func FrPow

func FrPow(a mcl.Fr, n int64) mcl.Fr

Computes the a^x, where a is mcl.Fr and x is int64

func G1Fold

func G1Fold(x mcl.Fr, vec1 []mcl.G1, vec2 []mcl.G1) []mcl.G1

G1Fold performs element wise: result = x * vec1 + vec2 Ex: result[0] = x * vec1[0] + vec2[0] vec1 and vec2 has to be same size Parameters ---------- result: G1 slice where the results are stored x : Fr, the exponent vec1: slice of mcl.G1 vec2: slice of mcl.G1 Returns -------

func G1SliceIsEqual

func G1SliceIsEqual(a, b []mcl.G1) bool

func G1VecRandExpo

func G1VecRandExpo(A []mcl.G1, r mcl.Fr, m int) []mcl.G1

// Add the randomness to the vector // a_0, a_1, a_2, a_3, a_4, a_5will become // a_0, a_1, a_2^r, a_3^r, a_4^{r^2}, a_5^{r^2}.

func G2Fold

func G2Fold(x mcl.Fr, vec1 []mcl.G2, vec2 []mcl.G2) []mcl.G2

G2Fold performs element wise: result = x * vec1 + vec2 Ex: result[0] = x * vec1[0] + vec2[0] vec1 and vec2 has to be same size Parameters ---------- result: G2 slice where the results are stored x : Fr, the exponent vec1: slice of mcl.G2 vec2: slice of mcl.G2 Returns ------- None. Call by reference, thus output is stored in variable result

func G2SliceIsEqual

func G2SliceIsEqual(a, b []mcl.G2) bool

func G2VecRandExpo

func G2VecRandExpo(A []mcl.G2, r mcl.Fr, m int) []mcl.G2

// Add the randomness to the vector // a_0, a_1, a_2, a_3, a_4, a_5will become // a_0, a_1, a_2^r, a_3^r, a_4^{r^2}, a_5^{r^2}.

func GenerateBatchingData

func GenerateBatchingData(m uint32, n uint32) ([]mcl.G1, []mcl.G2, []mcl.G1, []mcl.G2)

e(P_i, Q_i) = e(A_i, B_i)...e(A_m, B_m) This will keep Q_i's and B_i's the same This will allows us to test both batch.Verify and batch.VerifyEdrax

func GenerateData

func GenerateData(m uint64) ([]mcl.G1, []mcl.G2)

func GetFrByteSize

func GetFrByteSize() int

func GetG1ByteSize

func GetG1ByteSize() int

func GetG2ByteSize

func GetG2ByteSize() int

func GetGTByteSize

func GetGTByteSize() int

func InnerProd

func InnerProd(A []mcl.G1, B []mcl.G2) mcl.GT

InnerProd computes the inner product of vector A and vector B

func InstanceSizeChecker

func InstanceSizeChecker(M uint64, msg string)

Check if anywhere we are dealing with instance size which not a power of 2. Works with Init() Of course, someone can directly change M or any exported parameters of any argument system.

func IsPow2

func IsPow2(m uint64) bool

ValidM checks if the input is a power of 2

func MinUint64

func MinUint64(a uint64, b uint64) uint64

func NextPowOf2

func NextPowOf2(v uint64) uint64

Find the nextpow of 2 >= input, expect for 0.

func RunMPC

func RunMPC() (mcl.Fr, mcl.Fr, mcl.G1, mcl.G2)

Returns alpha, beta, G, H

func SizeMismatchCheck

func SizeMismatchCheck(a, b uint64, msg string)

Types

This section is empty.

Jump to

Keyboard shortcuts

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