openGPMP
Open Source Mathematics Package
nt.py
Go to the documentation of this file.
1 # This file was automatically generated by SWIG (https://www.swig.org).
2 # Version 4.1.0
3 #
4 # Do not make changes to this file unless you know what you are doing - modify
5 # the SWIG interface file instead.
6 
7 from sys import version_info as _swig_python_version_info
8 # Import the low-level C/C++ module
9 if __package__ or "." in __name__:
10  from . import _nt
11 else:
12  import _nt
13 
14 try:
15  import builtins as __builtin__
16 except ImportError:
17  import __builtin__
18 
19 def _swig_repr(self):
20  try:
21  strthis = "proxy of " + self.this.__repr__()
22  except __builtin__.Exception:
23  strthis = ""
24  return "<%s.%s; %s >" % (self.__class__.__module__, self.__class__.__name__, strthis,)
25 
26 
27 def _swig_setattr_nondynamic_instance_variable(set):
28  def set_instance_attr(self, name, value):
29  if name == "this":
30  set(self, name, value)
31  elif name == "thisown":
32  self.this.own(value)
33  elif hasattr(self, name) and isinstance(getattr(type(self), name), property):
34  set(self, name, value)
35  else:
36  raise AttributeError("You cannot add instance attributes to %s" % self)
37  return set_instance_attr
38 
39 
40 def _swig_setattr_nondynamic_class_variable(set):
41  def set_class_attr(cls, name, value):
42  if hasattr(cls, name) and not isinstance(getattr(cls, name), property):
43  set(cls, name, value)
44  else:
45  raise AttributeError("You cannot add class attributes to %s" % cls)
46  return set_class_attr
47 
48 
49 def _swig_add_metaclass(metaclass):
50  """Class decorator for adding a metaclass to a SWIG wrapped class - a slimmed down version of six.add_metaclass"""
51  def wrapper(cls):
52  return metaclass(cls.__name__, cls.__bases__, cls.__dict__.copy())
53  return wrapper
54 
55 
56 class _SwigNonDynamicMeta(type):
57  """Meta class to enforce nondynamic attributes (no new attributes) for a class"""
58  __setattr__ = _swig_setattr_nondynamic_class_variable(type.__setattr__)
59 
60 
61 class SwigPyIterator(object):
62  thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
63 
64  def __init__(self, *args, **kwargs):
65  raise AttributeError("No constructor defined - class is abstract")
66  __repr__ = _swig_repr
67  __swig_destroy__ = _nt.delete_SwigPyIterator
68 
69  def value(self):
70  return _nt.SwigPyIterator_value(self)
71 
72  def incr(self, n=1):
73  return _nt.SwigPyIterator_incr(self, n)
74 
75  def decr(self, n=1):
76  return _nt.SwigPyIterator_decr(self, n)
77 
78  def distance(self, x):
79  return _nt.SwigPyIterator_distance(self, x)
80 
81  def equal(self, x):
82  return _nt.SwigPyIterator_equal(self, x)
83 
84  def copy(self):
85  return _nt.SwigPyIterator_copy(self)
86 
87  def next(self):
88  return _nt.SwigPyIterator_next(self)
89 
90  def __next__(self):
91  return _nt.SwigPyIterator___next__(self)
92 
93  def previous(self):
94  return _nt.SwigPyIterator_previous(self)
95 
96  def advance(self, n):
97  return _nt.SwigPyIterator_advance(self, n)
98 
99  def __eq__(self, x):
100  return _nt.SwigPyIterator___eq__(self, x)
101 
102  def __ne__(self, x):
103  return _nt.SwigPyIterator___ne__(self, x)
104 
105  def __iadd__(self, n):
106  return _nt.SwigPyIterator___iadd__(self, n)
107 
108  def __isub__(self, n):
109  return _nt.SwigPyIterator___isub__(self, n)
110 
111  def __add__(self, n):
112  return _nt.SwigPyIterator___add__(self, n)
113 
114  def __sub__(self, *args):
115  return _nt.SwigPyIterator___sub__(self, *args)
116  def __iter__(self):
117  return self
118 
119 # Register SwigPyIterator in _nt:
120 _nt.SwigPyIterator_swigregister(SwigPyIterator)
121 class Basics(object):
122  thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
123  __repr__ = _swig_repr
124 
125  def greatest_power(self, n, p):
126  return _nt.Basics_greatest_power(self, n, p)
127 
128  def op_gcd(self, x, y):
129  return _nt.Basics_op_gcd(self, x, y)
130 
131  def __init__(self):
132  _nt.Basics_swiginit(self, _nt.new_Basics())
133  __swig_destroy__ = _nt.delete_Basics
134 
135 # Register Basics in _nt:
136 _nt.Basics_swigregister(Basics)
137 class PrimalityTest(object):
138  thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
139  __repr__ = _swig_repr
140 
141  def is_prime(self, n):
142  return _nt.PrimalityTest_is_prime(self, n)
143 
144  def compute_miller_rabin(self, d, n):
145  return _nt.PrimalityTest_compute_miller_rabin(self, d, n)
146 
147  def miller_rabin_prime(self, n, iters):
148  return _nt.PrimalityTest_miller_rabin_prime(self, n, iters)
149 
150  def miller_rabin(self, iters, min_val, max_val):
151  return _nt.PrimalityTest_miller_rabin(self, iters, min_val, max_val)
152 
153  def witness(self, n, d, a, s):
154  return _nt.PrimalityTest_witness(self, n, d, a, s)
155 
156  def AKS(self, n):
157  return _nt.PrimalityTest_AKS(self, n)
158 
159  def jacobian_number(self, a, n):
160  return _nt.PrimalityTest_jacobian_number(self, a, n)
161 
162  def solovoy_strassen(self, p, iters):
163  return _nt.PrimalityTest_solovoy_strassen(self, p, iters)
164 
165  def mod_mul(self, a, b, m):
166  return _nt.PrimalityTest_mod_mul(self, a, b, m)
167 
168  def mod_pow(self, a, b, m):
169  return _nt.PrimalityTest_mod_pow(self, a, b, m)
170 
171  def carmichael_num(self, n):
172  return _nt.PrimalityTest_carmichael_num(self, n)
173 
174  def ETF(self, n):
175  return _nt.PrimalityTest_ETF(self, n)
176 
177  def __init__(self):
178  _nt.PrimalityTest_swiginit(self, _nt.new_PrimalityTest())
179  __swig_destroy__ = _nt.delete_PrimalityTest
180 
181 # Register PrimalityTest in _nt:
182 _nt.PrimalityTest_swigregister(PrimalityTest)
183 class PrimalityGen(object):
184  thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
185  __repr__ = _swig_repr
186 
187  def sieve_of_eratosthenes(self, n):
188  return _nt.PrimalityGen_sieve_of_eratosthenes(self, n)
189 
190  def __init__(self):
191  _nt.PrimalityGen_swiginit(self, _nt.new_PrimalityGen())
192  __swig_destroy__ = _nt.delete_PrimalityGen
193 
194 # Register PrimalityGen in _nt:
195 _nt.PrimalityGen_swigregister(PrimalityGen)
196 class Logarithms(object):
197  thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
198  __repr__ = _swig_repr
199 
200  def pollard_rho_log(self, a, b, m):
201  return _nt.Logarithms_pollard_rho_log(self, a, b, m)
202 
203  def BSGS(self, a, b, m):
204  return _nt.Logarithms_BSGS(self, a, b, m)
205 
206  def __init__(self):
207  _nt.Logarithms_swiginit(self, _nt.new_Logarithms())
208  __swig_destroy__ = _nt.delete_Logarithms
209 
210 # Register Logarithms in _nt:
211 _nt.Logarithms_swigregister(Logarithms)
212 class Factorization(object):
213  thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
214  __repr__ = _swig_repr
215 
216  def pollard_rho(self, n):
217  return _nt.Factorization_pollard_rho(self, n)
218 
219  def __init__(self):
220  _nt.Factorization_swiginit(self, _nt.new_Factorization())
221  __swig_destroy__ = _nt.delete_Factorization
222 
223 # Register Factorization in _nt:
224 _nt.Factorization_swigregister(Factorization)
225 BITS = _nt.BITS
226 BYTE_LIMIT = _nt.BYTE_LIMIT
227 class RC4(object):
228  thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
229  __repr__ = _swig_repr
230 
231  def byte_swap(self, a, b):
232  return _nt.RC4_byte_swap(self, a, b)
233 
234  def trad_swap(self, a, b):
235  return _nt.RC4_trad_swap(self, a, b)
236 
237  def XOR_swap(self, a, b):
238  return _nt.RC4_XOR_swap(self, a, b)
239 
240  def KSA(self, key, S, swap_type):
241  return _nt.RC4_KSA(self, key, S, swap_type)
242 
243  def PRGA(self, S, plaintext, ciphertext, swap_type):
244  return _nt.RC4_PRGA(self, S, plaintext, ciphertext, swap_type)
245 
246  def store_hash(self, plaintext, hashtext, swap_type):
247  return _nt.RC4_store_hash(self, plaintext, hashtext, swap_type)
248 
249  def compute(self, key, plaintext, hashtext, swap_type):
250  return _nt.RC4_compute(self, key, plaintext, hashtext, swap_type)
251 
252  def __init__(self):
253  _nt.RC4_swiginit(self, _nt.new_RC4())
254  __swig_destroy__ = _nt.delete_RC4
255 
256 # Register RC4 in _nt:
257 _nt.RC4_swigregister(RC4)
258 class Cipher(object):
259  thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
260  __repr__ = _swig_repr
261 
262  def caesar(self, plaintext, key):
263  return _nt.Cipher_caesar(self, plaintext, key)
264 
265  def keyword_encode(self, key):
266  return _nt.Cipher_keyword_encode(self, key)
267 
268  def keyword(self, plaintext, encoded_text):
269  return _nt.Cipher_keyword(self, plaintext, encoded_text)
270 
271  def __init__(self):
272  _nt.Cipher_swiginit(self, _nt.new_Cipher())
273  __swig_destroy__ = _nt.delete_Cipher
274 
275 # Register Cipher in _nt:
276 _nt.Cipher_swigregister(Cipher)
277 
def __init__(self)
Definition: nt.py:131
def greatest_power(self, n, p)
Definition: nt.py:125
def op_gcd(self, x, y)
Definition: nt.py:128
def caesar(self, plaintext, key)
Definition: nt.py:262
def __init__(self)
Definition: nt.py:271
def keyword_encode(self, key)
Definition: nt.py:265
def keyword(self, plaintext, encoded_text)
Definition: nt.py:268
def pollard_rho(self, n)
Definition: nt.py:216
def __init__(self)
Definition: nt.py:219
def __init__(self)
Definition: nt.py:206
def BSGS(self, a, b, m)
Definition: nt.py:203
def pollard_rho_log(self, a, b, m)
Definition: nt.py:200
def __init__(self)
Definition: nt.py:190
def sieve_of_eratosthenes(self, n)
Definition: nt.py:187
def carmichael_num(self, n)
Definition: nt.py:171
def miller_rabin_prime(self, n, iters)
Definition: nt.py:147
def solovoy_strassen(self, p, iters)
Definition: nt.py:162
def ETF(self, n)
Definition: nt.py:174
def compute_miller_rabin(self, d, n)
Definition: nt.py:144
def is_prime(self, n)
Definition: nt.py:141
def witness(self, n, d, a, s)
Definition: nt.py:153
def mod_pow(self, a, b, m)
Definition: nt.py:168
def AKS(self, n)
Definition: nt.py:156
def miller_rabin(self, iters, min_val, max_val)
Definition: nt.py:150
def mod_mul(self, a, b, m)
Definition: nt.py:165
def jacobian_number(self, a, n)
Definition: nt.py:159
def __init__(self)
Definition: nt.py:177
def __init__(self)
Definition: nt.py:252
def compute(self, key, plaintext, hashtext, swap_type)
Definition: nt.py:249
def trad_swap(self, a, b)
Definition: nt.py:234
def PRGA(self, S, plaintext, ciphertext, swap_type)
Definition: nt.py:243
def store_hash(self, plaintext, hashtext, swap_type)
Definition: nt.py:246
def KSA(self, key, S, swap_type)
Definition: nt.py:240
def byte_swap(self, a, b)
Definition: nt.py:231
def XOR_swap(self, a, b)
Definition: nt.py:237