func NewMultiplySender(ctxHash *hash.Hash, setup *CorreOTSendSetup, alpha curve.Scalar) *MultiplySender {
	group := alpha.Curve()
	gadget := makeGadget(ctxHash, group)
	var doubleAlpha [2]curve.Scalar
	doubleAlpha[0] = alpha
	doubleAlpha[1] = sample.Scalar(rand.Reader, group)
	return &MultiplySender{
		ctxHash:     ctxHash,
		group:       group,
		setup:       setup,
		gadget:      gadget,
		doubleAlpha: doubleAlpha,
		sender:      NewAdditiveOTSender(ctxHash, setup, len(gadget), doubleAlpha),
	}
}
NewMultiplySender initializes the Sender for the multiplication protocol.

The Sender has a scalar alpha, the Receiver beta, and the goal is to create an additive
sharing of alpha * beta.

This follows Protocol 5 of https://eprint.iacr.org/2018/4990.
package ot
import (
	"crypto/rand"
	"errors"
	"github.com/cronokirby/safenum"
	"github.com/taurusgroup/multi-party-sig/internal/params"
	"github.com/taurusgroup/multi-party-sig/pkg/hash"
	"github.com/taurusgroup/multi-party-sig/pkg/math/curve"
	"github.com/taurusgroup/multi-party-sig/pkg/math/sample"
)
func scalarBytes(group curve.Curve) int {
	return (group.ScalarBits() + 7) & ^0b111
}
func encode(beta curve.Scalar, noise []curve.Scalar) ([]byte, error) {
	group := beta.Curve()
	gamma := make([]byte, len(noise)/8)
	_, _ = rand.Read(gamma)
	acc := group.NewScalar().Set(beta)
	mulNat := new(safenum.Nat)
	mul := group.NewScalar()
	for i := 0; i < len(noise); i++ {
		mulNat.SetUint64(uint64((gamma[i>>3] >> (i & 0b111)) & 1))
		acc.Sub(mul.SetNat(mulNat).Mul(noise[i]))
	}
	data, err := acc.MarshalBinary()
	if err != nil {
		return nil, err
	}
	data = append(data, gamma...)
	return data, nil
}
func makeGadget(ctxHash *hash.Hash, group curve.Curve) []curve.Scalar {
	scalarEnd := scalarBytes(group)
	out := make([]curve.Scalar, 8*((group.ScalarBits()+7)/8+(group.ScalarBits()+2*params.StatParam+7)/8))
	acc := group.NewScalar().SetNat(new(safenum.Nat).SetUint64(1))
	for i := (scalarEnd >> 3) - 1; i >= 0; i-- {
		for j := 0; j < 8; j++ {
			out[(i<<3)|j] = group.NewScalar().Set(acc)
			acc.Add(acc)
		}
	}
	digest := ctxHash.Fork(&hash.BytesWithDomain{TheDomain: "Multiply Gadget Sampling", Bytes: nil}).Digest()
	for i := scalarEnd; i < len(out); i++ {
		out[i] = sample.Scalar(digest, group)
	}
	return out
}
type MultiplySender struct {
	ctxHash     *hash.Hash
	group       curve.Curve
	setup       *CorreOTSendSetup
	doubleAlpha [2]curve.Scalar
	gadget      []curve.Scalar
	sender      *AdditiveOTSender
}