INNER CODE UNIT · Go

Encrypt

taurushq-io/multi-party-sig · internal/elgamal/elgamal.go:24

func Encrypt(public PublicKey, message curve.Scalar) (*Ciphertext, Nonce) {
	group := public.Curve()
	nonce := sample.Scalar(rand.Reader, group)
	L := nonce.ActOnBase()
	M := message.ActOnBase().Add(nonce.Act(public))
	return &Ciphertext{
		L: L,
		M: M,
	}, nonce
}

// Valid returns true if the ciphertext passes basic validation.
func (c *Ciphertext) Valid() bool {
	if c == nil || c.L == nil || c.L.IsIdentity() ||
		c.M == nil || c.M.IsIdentity() {
		return false
	}
	return true

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…