curve.go 322 B

123456789101112131415161718
  1. package curve
  2. import (
  3. "context"
  4. "math/big"
  5. "git.ali33.ru/fcg-xvii/curve/v2/tools"
  6. )
  7. func NewCurve(a, b, p *big.Int, ctx context.Context) (curve *tools.Curve, err error) {
  8. if curve, err = tools.NewCurve(a, b); err != nil {
  9. return
  10. }
  11. p = tools.SearchPrime(p)
  12. curve.SetP(p)
  13. err = curve.SetGRandom(ctx)
  14. return
  15. }