elgamal

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Oct 5, 2023 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Copyright IBM Corp. All Rights Reserved.

SPDX-License-Identifier: Apache-2.0

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Ciphertext

type Ciphertext struct {
	C1 *math.G1
	C2 *math.G1
}

Ciphertext is an Elgamal ciphertext C = (g^r, Mh^r)

type PublicKey

type PublicKey struct {
	Gen   *math.G1
	H     *math.G1
	Curve *math.Curve
}

PublicKey is Elgamal public key (g, h= g^x)

func (*PublicKey) Encrypt

func (pk *PublicKey) Encrypt(M *math.G1) (*Ciphertext, *math.Zr, error)

Encrypt returns an Elgamal ciphertext of elliptic curve point M and the randomness used to compute it

func (*PublicKey) EncryptZr

func (pk *PublicKey) EncryptZr(m *math.Zr) (*Ciphertext, *math.Zr, error)

EncryptZr encrypts a message m in Zr using Elgamal encryption EncryptZr returns C = (g^r, g^mh^r) and randomness r

type SecretKey

type SecretKey struct {
	*PublicKey
	// contains filtered or unexported fields
}

SecretKey is Elgamal secret key x

func NewSecretKey

func NewSecretKey(sk *math.Zr, gen, pk *math.G1, c *math.Curve) *SecretKey

func (*SecretKey) Decrypt

func (sk *SecretKey) Decrypt(c *Ciphertext) (*math.G1, error)

Decrypt returns a elliptic curve point M such that C = (g^r, Mh^r)

Jump to

Keyboard shortcuts

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