sample

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Feb 21, 2024 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 IntervalEps

func IntervalEps(rand io.Reader) *saferith.Int

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

func IntervalL

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

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

func IntervalLEps

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

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

func IntervalLEpsN

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

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

func IntervalLEpsN2

func IntervalLEpsN2(rand io.Reader) *saferith.Int

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

func IntervalLEpsRootN

func IntervalLEpsRootN(rand io.Reader) *saferith.Int

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

func IntervalLN

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

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

func IntervalLN2

func IntervalLN2(rand io.Reader) *saferith.Int

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

func IntervalLPrime

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

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

func IntervalLPrimeEps

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

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

func IntervalScalar

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

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

func ModN

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

ModN samples an element of ℤₙ.

func Paillier

func Paillier(rand io.Reader, pl *pool.Pool) (p, q *saferith.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 *saferith.Nat, n *saferith.Modulus) (s, t, lambda *saferith.Nat)

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

func QNR

func QNR(rand io.Reader, n *saferith.Modulus) *saferith.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 *saferith.Modulus) *saferith.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