field = GF(3**2, 'g') g = field.gen() R = PolynomialRing(field, "x") points = [(0, 1),(1, g), (g,g), (g+1, g)] newpol = R.lagrange_polynomial(points) newpol
# from sage.crypto.sbox import SBox # S = SBox(7, 0, 4, 12, 11, 8, 2, 1, 15, 3, 5, 6, 9, 10, 13, 14) # pol = S.interpolation_polynomial() # pol
from sympy import Eq from sympy.abc import x,g from sympy.utilities.lambdify import lambdify f = lambdify([x,g], newpol)
# #Working Function Maker # from sympy.abc import x # from sympy.utilities.lambdify import lambdify, implemented_function # f = implemented_function('f', lambda x: newpol) # lam_f = lambdify(x, f(x))
#GF(2**N) n = int(input()) p = 4 FF.<g> = GF(p**n) FFlist = list(FF) print(FFlist)
---------------------------------------------------------------------------
KeyboardInterrupt Traceback (most recent call last)
<ipython-input-3-4d0d8c5ed53a> in <module>
1 #GF(2**N)
----> 2 n = int(input())
3 p = Integer(4)
4 FF = GF(p**n, names=('g',)); (g,) = FF._first_ngens(1)
5 FFlist = list(FF)
/ext/sage/sage-9.2/local/lib/python3.8/site-packages/ipykernel/kernelbase.py in raw_input(self, prompt)
858 "raw_input was called, but this frontend does not support input requests."
859 )
--> 860 return self._input_request(str(prompt),
861 self._parent_ident,
862 self._parent_header,
/ext/sage/sage-9.2/local/lib/python3.8/site-packages/ipykernel/kernelbase.py in _input_request(self, prompt, ident, parent, password)
891 except KeyboardInterrupt:
892 # re-raise KeyboardInterrupt, to truncate traceback
--> 893 raise KeyboardInterrupt("Interrupted by user") from None
894 else:
895 break
KeyboardInterrupt: Interrupted by user
for x in FFlist: print (f(x,g))