multiexp

package module
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Jan 30, 2023 License: BSD-3-Clause Imports: 4 Imported by: 2

README

Multi-EXP

Fast big-integer exponentiation functions.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DoubleExp

func DoubleExp(x *big.Int, y2 [2]*big.Int, m *big.Int) [2]*big.Int

DoubleExp sets z1 = x**y1 mod |m|, z2 = x**y2 mod |m| ... (i.e. the sign of m is ignored), and returns z1, z2. If m == nil or m == 0, z = x**y unless y <= 0 then z = 1. If m != 0, y < 0, and x and m are not relatively prime, z is unchanged and nil is returned.

DoubleExp is not a cryptographically constant-time operation.

func ExpParallel added in v0.0.4

func ExpParallel(x, y, m *big.Int, preTable *PreTable, numRoutine, wordChunkSize int) *big.Int

ExpParallel computes x ** y mod |m| utilizing multiple CPU cores numRoutine specifies the number of routine for computing the result

func FourfoldExp added in v0.0.4

func FourfoldExp(x, m *big.Int, y4 [4]*big.Int) [4]*big.Int

FourfoldExp sets z1 = x**y1 mod |m|, z2 = x**y2 mod |m| ... (i.e. the sign of m is ignored), and returns z1, z2... In construction, many panic conditions. Use at your own risk!

FourfoldExp is not a cryptographically constant-time operation.

func FourfoldExpPrecomputed added in v0.0.5

func FourfoldExpPrecomputed(x, m *big.Int, y4 [4]*big.Int, preTable *PreTable) [4]*big.Int

FourfoldExpPrecomputed sets z1 = x**y1 mod |m|, z2 = x**y2 mod |m| ... (i.e. the sign of m is ignored), and returns z1, z2... In construction, many panic conditions. Use at your own risk! Use single thread FourfoldExpPrecomputed is not a cryptographically constant-time operation.

func FourfoldExpPrecomputedParallel added in v0.0.4

func FourfoldExpPrecomputedParallel(x, m *big.Int, y4 [4]*big.Int, preTable *PreTable) [4]*big.Int

FourfoldExpPrecomputedParallel sets z1 = x**y1 mod |m|, z2 = x**y2 mod |m| ... (i.e. the sign of m is ignored), and returns z1, z2... In construction, many panic conditions. Use at your own risk! Use at most 4 threads for now. FourfoldExpPrecomputedParallel is not a cryptographically constant-time operation.

Types

type PreTable

type PreTable struct {
	Base      *big.Int
	Modulus   *big.Int
	TableSize int
	// contains filtered or unexported fields
}

PreTable is the pre-computation table for multi-exponentiation

func NewPrecomputeTable added in v0.0.4

func NewPrecomputeTable(base, modular *big.Int, tableSize int) *PreTable

NewPrecomputeTable creates a pre-computation table for multi-exponentiation

type Word added in v0.0.4

type Word uint

Jump to

Keyboard shortcuts

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