dleq

package module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jan 13, 2023 License: LGPL-3.0 Imports: 5 Imported by: 1

README

go-dleq

This repo contains an implementation of cross-group discrete logarithm equality as specified in MRL-0010. In addition to what's specified in the paper, it contains an additional proof of knowledge of the witness ie. a signature on both curves. Currently, secp256k1 and ed25519 are supported. The library is written such that other curves can be added.

Usage

import (
    "github.com/athanorlabs/go-dleq"
    "github.com/athanorlabs/go-dleq/ed25519"
    "github.com/athanorlabs/go-dleq/secp256k1"
)

curveA := secp256k1.NewCurve()
curveB := ed25519.NewCurve()
x, err := dleq.GenerateSecretForCurves(curveA, curveB)
if err != nil {
    panic(err)
}

proof, err := dleq.NewProof(curveA, curveB, x)
if err != nil {
    panic(err)
}

err = proof.Verify(curveA, curveB)
if err != nil {
    panic(err)
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateSecretForCurves

func GenerateSecretForCurves(curveA, curveB Curve) ([32]byte, error)

GenerateSecretForCurves generates a secret value that has a corresponding commitment on both curves.

Types

type Curve

type Curve = types.Curve

type Point

type Point = types.Point

type Proof

type Proof struct {
	CommitmentA, CommitmentB Point
	// contains filtered or unexported fields
}

Proof represents a DLEq proof and commitment to the witness.

func NewProof

func NewProof(curveA, curveB Curve, x [32]byte) (*Proof, error)

NewProof returns a new proof for the given secret on the given curves. The witness x must be in little-endian and smaller than the minimum order of the two curves.

func (*Proof) Deserialize

func (p *Proof) Deserialize(curveA, curveB types.Curve, in []byte) error

Deserialize decodes the proof for the given curves. The curves must match those passed into `NewProof`.

func (*Proof) Serialize

func (p *Proof) Serialize() []byte

Serialize encodes the proof.

func (*Proof) Verify

func (p *Proof) Verify(curveA, curveB Curve) error

Verify verifies the proof is valid against the given curves. TODO: encode curves into proof somehow?

type Scalar

type Scalar = types.Scalar

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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