Skip to content

Instantly share code, notes, and snippets.

@autotaker
Created March 20, 2017 04:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save autotaker/8bcd0ce53f61a87c8742e697917cfae1 to your computer and use it in GitHub Desktop.
Save autotaker/8bcd0ce53f61a87c8742e697917cfae1 to your computer and use it in GitHub Desktop.
g = ffgen((x^256 + x^10 + x^5 + x^2 + 1)* Mod(1,2), 'x);
int2ff(n, g) = { subst(Pol(digits(n, g.p)), 'x, g) };
ff2int(x) = { subst(x.pol, variable(x.pol), x.p) };
c1=79267468907649481004031669197619294997861358148687669164280161107568250560639
c2=44804956138029594877678183404451458957271575260252646638476893887508109415484
c3=105423975506774012983169132796348436324065606442637215942997207372385819512091
m2=33187360835812316451114895390418536388082057316848544621384752934291486240101
m3=46315061891984415653414698371505035098503951411565883566135560804212672652901
c1 = int2ff(c1, g)
c2 = int2ff(c2, g)
c3 = int2ff(c3, g)
m2 = int2ff(m2, g)
m3 = int2ff(m3, g)
r2 = c3 + m3
r1 = c2 + m2
k = sqrt(r2 + r1^2)
r0 = sqrt(r1 + r2 + r1^2)
m1 = c1 + r0
print(ff2int(m1))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment