mathutils

package
v0.0.0-...-66b4571 Latest Latest
Warning

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

Go to latest
Published: Jul 31, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const MAX_PRIMALITY_CHECK = 5

Variables

This section is empty.

Functions

func Abs

func Abs(x *big.Int) *big.Int

Abs returns |x|.

func BarrettReduce

func BarrettReduce(x, q, mu uint64) uint64

func BitReverse

func BitReverse(x int) int

func FactorByPollardRho

func FactorByPollardRho(n *big.Int) []uint64

FactorByPollardRho finds the prime factors by applying PollardRho technique.

func FindPrimitiveRoots

func FindPrimitiveRoots(q, order uint64, factors []uint64) uint64

FindPrimitiveRoots discovers all primitive N-th roots of unity modulo Q. It iterates over candidates in [2, Q) and tests each using the Extended Euclidean Algorithm to verify that it generates the full multiplicative order (Q-1)/gcd(N, Q-1) and in returns the count of valid primitive roots.

func ModInverse32

func ModInverse32(q uint32) uint32

func ModMul

func ModMul(a, b, mod int) int

func ModPow

func ModPow(base, exp, mod int) int

func ModPowWithBarrett

func ModPowWithBarrett(base, exp, q uint64) uint64

Types

This section is empty.

Jump to

Keyboard shortcuts

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