|
@@ -112,16 +112,6 @@ func (s *Curve) SetP(p *big.Int) (err error) {
|
|
|
return
|
|
|
}
|
|
|
s.p = p
|
|
|
- /*if !IsPrime(Div(Sub(p, 1), 2)) {
|
|
|
-
|
|
|
- }*/
|
|
|
- /*
|
|
|
- if p.Cmp(MinP) < 0 {
|
|
|
- err = fmt.Errorf("слишком маленький размер конечного поля [ %s ]", p)
|
|
|
- return
|
|
|
- }
|
|
|
- */
|
|
|
- //s.p = new(big.Int).Set(p)
|
|
|
// сброс подгруппы
|
|
|
s.n = nil
|
|
|
s.h = nil
|
|
@@ -166,6 +156,13 @@ func (s *Curve) InverseMod(k, p *big.Int) (res *big.Int, err error) {
|
|
|
return
|
|
|
}
|
|
|
|
|
|
+func (s *Curve) Points(dx *big.Int) (p1, p2 *Point, err error) {
|
|
|
+ if err = s.IsValidN(); err != nil {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ return s.points(x)
|
|
|
+}
|
|
|
+
|
|
|
// Определение координат пары зеркальных точек по x
|
|
|
func (s *Curve) points(dx *big.Int) (p1, p2 *Point, err error) {
|
|
|
dxx := intCopy(dx)
|
|
@@ -204,6 +201,13 @@ func (s *Curve) points(dx *big.Int) (p1, p2 *Point, err error) {
|
|
|
return
|
|
|
}
|
|
|
|
|
|
+func (s *Curve) SearchClosePoints(x *big.Int) (p1, p2 *Point, err error) {
|
|
|
+ if err = s.IsValidN(); err != nil {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ return s.searhClosePoints(x)
|
|
|
+}
|
|
|
+
|
|
|
func (s *Curve) searhClosePoints(x *big.Int) (p1, p2 *Point, err error) {
|
|
|
cx := intCopy(x)
|
|
|
if x.Cmp(s.p) >= 0 {
|