From cf074191532caef918fb9f502b37697094da317a Mon Sep 17 00:00:00 2001 From: J08nY Date: Thu, 18 Jan 2018 18:37:44 +0100 Subject: Add curve twists to CLI and update options in README. --- src/math/twists.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'src/math/twists.c') diff --git a/src/math/twists.c b/src/math/twists.c index 78481f4..3f1296d 100644 --- a/src/math/twists.c +++ b/src/math/twists.c @@ -3,8 +3,10 @@ * Copyright (C) 2017-2018 J08nY */ #include "twists.h" +#include "gen/point.h" +#include "gen/seed.h" -void curve_twist_rand(curve_t *to, const curve_t *of) { +void twist_rand_to(curve_t *to, const curve_t *of) { to->field = gcopy(of->field); GEN v = elltwist(of->curve, NULL); to->curve = ellinit(v, to->field, -1); @@ -15,4 +17,12 @@ void curve_twist_rand(curve_t *to, const curve_t *of) { to->a = ell_get_a2(to->curve); to->b = ell_get_a6(to->curve); } +} + +void twist_rand(curve_t *what) { + twist_rand_to(what, what); + seed_free(&what->seed); + what->order = NULL; + points_free_deep(&what->points, what->npoints); + points_free_deep(&what->generators, what->ngens); } \ No newline at end of file -- cgit v1.2.3-70-g09d2