bls-init.sage 941 B

1234567891011121314151617181920212223242526272829
  1. q = 0x1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaab
  2. F1 = GF(q)
  3. # F₂ is constructed as F(u) / (u² + 1)
  4. # F₆ is constructed as F₂(v) / (v³- (u + 1))
  5. # F₁₂ is constructed as F₆(w) / (w²- v)
  6. # we can't do extension field towers in sage...
  7. # https://ask.sagemath.org/question/49663/efficiently-computing-tower-fields-for-pairings/
  8. K2.<x> = PolynomialRing(F1)
  9. F2.<u> = F1.extension(x^2 + 1)
  10. # The last line in this section will hang forever
  11. #K6.<y> = PolynomialRing(F2)
  12. #F6.<v> = F2.extension(y^3 - (u + 1))
  13. #K12.<z> = PolynomialRing(F6)
  14. #F12.<w> = F6.extension(z^2 - v)
  15. # Alternative construction
  16. R.<y> = PolynomialRing(F2)
  17. # w is a root of a(y) = y^6 - (u + 1) and also b(y) = y^2 - v
  18. # v is a root of c(y) = y^3 - (u + 1), so to enlarge F2 -> F12, we use a(y)
  19. F12.<w> = F2.extension(y^6 - (u + 1))
  20. v = w^2
  21. assert u^2 + 1 == 0
  22. assert v^3 - (u + 1) == 0
  23. assert w^2 - v == 0