sample

package
v0.7.5 Latest Latest
Warning

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

Go to latest
Published: Jan 27, 2023 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrMaxIterations = fmt.Errorf("sample: failed to generate after %d iterations", maxIterations)

Functions

func IntervalL

func IntervalL(rand io.Reader) *safenum.Int

IntervalL returns an integer in the range ± 2ˡ, but with constant-time properties.

func IntervalLEps

func IntervalLEps(rand io.Reader) *safenum.Int

IntervalLEps returns an integer in the range ± 2ˡ⁺ᵉ, but with constant-time properties.

func IntervalLEpsN

func IntervalLEpsN(rand io.Reader) *safenum.Int

IntervalLEpsN returns an integer in the range ± 2ˡ⁺ᵉ•N, where N is the size of a Paillier modulus.

func IntervalLN

func IntervalLN(rand io.Reader) *safenum.Int

IntervalLN returns an integer in the range ± 2ˡ•N, where N is the size of a Paillier modulus.

func IntervalLPrime

func IntervalLPrime(rand io.Reader) *safenum.Int

IntervalLPrime returns an integer in the range ± 2ˡ', but with constant-time properties.

func IntervalLPrimeEps

func IntervalLPrimeEps(rand io.Reader) *safenum.Int

IntervalLPrimeEps returns an integer in the range ± 2ˡ'⁺ᵉ, but with constant-time properties.

func IntervalScalar

func IntervalScalar(rand io.Reader, group curve.Curve) *safenum.Int

IntervalScalar returns an integer in the range ±q, with q the size of a Scalar.

func ModN

func ModN(rand io.Reader, n *safenum.Modulus) *safenum.Nat

ModN samples an element of ℤₙ.

func Paillier

func Paillier(rand io.Reader, pl *pool.Pool) (p, q *safenum.Nat)

Paillier generate the necessary integers for a Paillier key pair. p, q are safe primes ((p - 1) / 2 is also prime), and Blum primes (p = 3 mod 4) n = pq.

func Pedersen

func Pedersen(rand io.Reader, phi *safenum.Nat, n *safenum.Modulus) (s, t, lambda *safenum.Nat)

Pedersen generates the s, t, λ such that s = tˡ.

func QNR

func QNR(rand io.Reader, n *safenum.Modulus) *safenum.Nat

QNR samples a random quadratic non-residue in Z_n.

func Scalar

func Scalar(rand io.Reader, group curve.Curve) curve.Scalar

Scalar returns a new *curve.Scalar by reading bytes from rand.

func ScalarPointPair

func ScalarPointPair(rand io.Reader, group curve.Curve) (curve.Scalar, curve.Point)

ScalarPointPair returns a new *curve.Scalar/*curve.Point tuple (x,X) by reading bytes from rand. The tuple satisfies X = x⋅G where G is the base point of the curve.

func ScalarUnit

func ScalarUnit(rand io.Reader, group curve.Curve) curve.Scalar

ScalarUnit returns a new *curve.Scalar by reading bytes from rand.

func UnitModN

func UnitModN(rand io.Reader, n *safenum.Modulus) *safenum.Nat

UnitModN returns a u ∈ ℤₙˣ.

Types

This section is empty.

Jump to

Keyboard shortcuts

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