zkmod

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: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Private

type Private struct {
	// P, Q primes such that
	// P, Q ≡ 3 mod 4
	P, Q *saferith.Nat
	// Phi = ϕ(n) = (p-1)(q-1)
	Phi *saferith.Nat
}

type Proof

type Proof struct {
	W         *big.Int
	Responses [params.StatParam]Response
}

func NewProof

func NewProof(hash *hash.Hash, private Private, public Public, pl *pool.Pool) *Proof

NewProof generates a proof that:

  • n = pq
  • p and q are odd primes
  • p, q == 3 (mod n)

With:

  • W s.t. (w/N) = -1
  • x = y' ^ {1/4}
  • z = y^{N⁻¹ mod ϕ(N)}
  • a, b s.t. y' = (-1)ᵃ wᵇ y
  • R = [(xᵢ aᵢ, bᵢ), zᵢ] for i = 1, …, m

func (*Proof) IsValid

func (p *Proof) IsValid(public Public) bool

func (*Proof) Verify

func (p *Proof) Verify(public Public, hash *hash.Hash, pl *pool.Pool) bool

type Public

type Public struct {
	// N = p*q
	N *saferith.Modulus
}

type Response

type Response struct {
	// A, B s.t. y' = (-1)ᵃ wᵇ y
	A, B bool
	// X = y' ^ {1/4}
	X *big.Int
	// Z = y^{N⁻¹ mod ϕ(N)}
	Z *big.Int
}

func (*Response) Verify

func (r *Response) Verify(n, w, y *big.Int) bool

Jump to

Keyboard shortcuts

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