-
Notifications
You must be signed in to change notification settings - Fork 7
/
adicops.h
65 lines (51 loc) · 1.52 KB
/
adicops.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
/*
* adicops.h
*
* Created on: Dec 15, 2009
* Author: bhess
*/
#ifndef ADICOPS_H_
#define ADICOPS_H_
//#define VERBOSE
#include <vector>
#include <gmpxx.h>
#include "arith/Poly.h"
#include "arith/ModPoly.h"
using namespace std;
class Adicops {
public:
Adicops(Poly mod);
static void do_s();
static void do_ntl();
static void crack_challenge1();
static void crack_challenge2();
Poly get_mod();
/**
* Computes the Teichmüller modulus
* with precision N
*/
void set_teichmuller_modulus(Poly in, int prec);
Poly teichmuller_modulus_increment(const Poly& M0, const Poly& M1,
const Poly& V, int N);
Poly poly_remainder(Poly a, int prec);
Poly poly_remainder(Poly a, Poly b, int prec);
Poly poly_division_rem(Poly num, Poly denom, int prec);
Poly poly_division(Poly num, Poly denom, int prec);
Poly poly_invert(Poly f, int p, int prec);
Poly get_inverse(Poly a, int prec);
Poly get_invsqrt(Poly a, Poly approx, int prec);
Poly get_sqrt(Poly a, int prec);
ModPoly get_inverse(ModPoly a, int prec);
ModPoly get_invsqrt(ModPoly a, ModPoly approx, int prec);
ModPoly get_sqrt(ModPoly a, int prec);
bool testsqrt(Poly sqrt, Poly in, Poly mod, int prec);
mpz_class get_points_AGM_bivariate(mpz_class _c, int d);
ZZ get_points_AGM_bivariate_v2(mpz_class _c, int d, ModPoly s);
mpz_class get_points_AGM_univariate(mpz_class _c, mpz_class _mod, int d);
void set_sqrtx(GFE _sqrtx) { sqrtx = _sqrtx;}
private:
Poly get_teichmuller_modulus(Poly in, int prec);
Poly mod;
GFE sqrtx;
};
#endif /* ADICOPS_H_ */