aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJ08nY2018-06-30 17:13:17 +0200
committerJ08nY2018-06-30 17:13:17 +0200
commit42f65f0cf9950d1695a9d49bafd3096407447438 (patch)
tree9df0366f618f52178421224a9ce237f97c3c2e45 /src
parent3e4c87f12d13cd0a2d139cf8a149874634972afa (diff)
downloadecgen-42f65f0cf9950d1695a9d49bafd3096407447438.tar.gz
ecgen-42f65f0cf9950d1695a9d49bafd3096407447438.tar.zst
ecgen-42f65f0cf9950d1695a9d49bafd3096407447438.zip
Diffstat (limited to 'src')
-rw-r--r--src/gen/order.c21
1 files changed, 2 insertions, 19 deletions
diff --git a/src/gen/order.c b/src/gen/order.c
index 20040ab..549879c 100644
--- a/src/gen/order.c
+++ b/src/gen/order.c
@@ -2,6 +2,7 @@
* ecgen, tool for generating Elliptic curve domain parameters
* Copyright (C) 2017-2018 J08nY
*/
+#include "field.h"
#include "order.h"
#include "exhaustive/arg.h"
#include "io/input.h"
@@ -126,26 +127,8 @@ CHECK(order_check_discriminant) {
GEN t = negi(subii(curve->order, addii(curve->field, gen_1)));
GEN tp = subii(sqri(t), mulis(curve->field, 4));
- GEN tp_factors = factor(tp);
-
- GEN tp_primes = gel(tp_factors, 1);
- GEN tp_pows = gel(tp_factors, 2);
- long tp_pow_len = glength(tp_pows);
- GEN value = gen_1;
- for (long i = 1; i <= tp_pow_len; ++i) {
- if (!dvdis(gel(tp_pows, i), 2)) {
- continue;
- }
- GEN one_value = powii(gel(tp_primes, i), divis(gel(tp_pows, i), 2));
- muliiz(value, one_value, value);
- }
- GEN s = value;
-
- GEN D = divii(tp, s);
- if (mod4(D) != 1) {
- D = mulis(D, 4);
- }
+ GEN D = field_elementi(core(tp));
if (abscmpii(D, mind) <= 0) {
avma = ltop;
return -4;