keygen

package
v0.0.0-...-a536860 Latest Latest
Warning

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

Go to latest
Published: Mar 10, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetGermainPrime

func GetGermainPrime(bits int) (p *big.Int)

GetGermainPrime returns a prime number p for which 2*p + 1 is also prime. Note that conversely 2*p + 1 is called a safe prime.

func GetSafePrime

func GetSafePrime(bits int) (p *big.Int, err error)

GetSafePrime returns a safe prime p (p = 2*p1 + 2 where p1 is prime too).

Types

type ElGamal

type ElGamal struct {
	Y *big.Int // public key
	G *big.Int // generator
	P *big.Int // modulus
	Q *big.Int // (P - 1) / 2, i.e. order of G
}

ElGamal holds paramenters for ElGamal scheme.

func NewElGamal

func NewElGamal(modulusLength int) (*ElGamal, error)

NewElGamal creates parameters for ElGamal scheme. Implementation is adapted from https://github.com/dlitz/pycrypto/blob/master/lib/Crypto/PublicKey/ElGamal.py.

Jump to

Keyboard shortcuts

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