ring

package
v0.0.0-...-3fbf41a Latest Latest
Warning

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

Go to latest
Published: Nov 17, 2021 License: GPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenKeyImage

func GenKeyImage(privKey *ecdsa.PrivateKey) *ecdsa.PublicKey

GenKeyImage calculates key image It is not possible to make a correlation between the public key and the corresponding key image I = x * H_p(P) where H_p is a hash function that returns a point H_p(P) = blake2b(P) * G

func GenKeyRing

func GenKeyRing(ring []*ecdsa.PublicKey, privKey *ecdsa.PrivateKey, s int) ([]*ecdsa.PublicKey, error)

GenKeyRing takes public key ring and places the public key corresponding to `privKey` in index s of the ring Returns a key ring of type []*ecdsa.PublicKey

func GenNewKeyRing

func GenNewKeyRing(size int, privKey *ecdsa.PrivateKey, s int) ([]*ecdsa.PublicKey, error)

GenNewKeyRing creates a ring with size specified by `size` and places the public key corresponding to `privKey` in index s of the ring Returns a new key ring of type []*ecdsa.PublicKey

func Hash

func Hash(m [32]byte, l, r []byte) [32]byte

Hash is a function that returns a value in Z_p (ed25519 base field)

func HashPoint

func HashPoint(p *ecdsa.PublicKey) (hx, hy *big.Int)

HashPoint returns point on the curve

func Link(sig1 *RingSign, sig2 *RingSign) bool

Link compares two signatures to check if they are signed by the same private key Same key image implies double-spend

func PadTo32Bytes

func PadTo32Bytes(in []byte) (out []byte)

func Verify

func Verify(sig *RingSign) bool

Verify checks the validity of the ring signature contained in RingSign struct returns true if a valid signature, false otherwise

Types

type L

type L []*ecdsa.PublicKey

func (L) Bytes

func (r L) Bytes() (b []byte)

Bytes returns the public key ring as a byte slice.

type RingSign

type RingSign struct {
	Size  int              // size of ring
	M     [32]byte         // message
	C     *big.Int         // ring signature value
	S     []*big.Int       // faked secret keys
	L     L                // array of public keys
	I     *ecdsa.PublicKey // key image
	Curve elliptic.Curve
}

func Deserialize

func Deserialize(r []byte) (*RingSign, error)

Deserialize converts the byteified signature into a RingSign struct

func Sign

func Sign(m [32]byte, L []*ecdsa.PublicKey, privKey *ecdsa.PrivateKey, s int) (*RingSign, error)

Sign creates a ring signature from list of public keys given inputs: m: byte array, message to be signed L: array of *ecdsa.PublicKeys to be included in the ring privKey: *ecdsa.PrivateKey of signer s: index of signer in ring

func (*RingSign) Serialize

func (r *RingSign) Serialize() ([]byte, error)

Serialize converts the signature to a byte array

Jump to

Keyboard shortcuts

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