Permalink
Find file
Fetching contributors…
Cannot retrieve contributors at this time
executable file 38 lines (33 sloc) 718 Bytes
#!/usr/bin/python -Wall
from f2poly_tm import *
from f2polymod_tm import *
import sys
ar = f2poly_t(0xa)
br = f2poly_t(0xb)
m = f2poly_t(0x13)
e = 3
argc = len(sys.argv)
if (argc == 4):
m = f2poly_from_string(sys.argv[1])
ar = f2poly_from_string(sys.argv[2])
br = f2poly_from_string(sys.argv[3])
if (argc == 5):
m = f2poly_from_string(sys.argv[1])
ar = f2poly_from_string(sys.argv[2])
br = f2poly_from_string(sys.argv[3])
e = int(sys.argv[4])
a = f2polymod_t(ar, m)
b = f2polymod_t(br, m)
print "a =", a
print "b =", b
s = a + b
d = a - b
p = a * b
q = a / b
print "a =", a
print "b =", b
print "sum =", s
print "diff =", d
print "prod =", p
print "quot =", q
print a, "**", e, "=", a**e