algopts

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Feb 8, 2024 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Overview

Package algopts provides shareable options for modifying algebraic operations.

This package is separate to avoid cyclic imports and sharing the structures between interface definition, implementation getters and actual implementations.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewConfig

func NewConfig(opts ...AlgebraOption) (*algebraCfg, error)

NewConfig applies all given options and returns a configuration to be used.

Types

type AlgebraOption

type AlgebraOption func(*algebraCfg) error

AlgebraOption allows modifying algebraic operation behaviour.

func WithCompleteArithmetic

func WithCompleteArithmetic() AlgebraOption

WithCompleteArithmetic forces the use of safe addition formulas for scalar multiplication.

func WithFoldingScalarMul

func WithFoldingScalarMul() AlgebraOption

WithFoldingScalarMul can be used when calling MultiScalarMul. By using this option we assume that the scalars are `1, scalar, scalar^2, ...`. We use the first element as the scalar to be used as a folding coefficients. By using this option we avoid one scalar multiplication and do not need to compute the powers of the folding coefficient.

func WithNbScalarBits

func WithNbScalarBits(bits int) AlgebraOption

WithNbScalarBits defines the number bits when doing scalar multiplication. May be used when it is known that only bits least significant bits are non-zero. Reduces the cost for scalar multiplication. If not set then full width of scalars used.

Jump to

Keyboard shortcuts

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