plonk.sage 688 B

12345678910111213141516171819202122232425
  1. q = 0x40000000000000000000000000000000224698fc0994a8dd8c46eb2100000001
  2. K = GF(q)
  3. # The pallas and vesta curves are 2-adic. This means there is a large
  4. # power of 2 subgroup within both of their fields.
  5. # This function finds a generator for this subgroup within the field.
  6. def get_omega():
  7. # Slower alternative:
  8. # generator = K.multiplicative_generator()
  9. # Just hardcode the value here instead
  10. generator = K(5)
  11. assert (q - 1) % 2**32 == 0
  12. # Root of unity
  13. t = (q - 1) / 2**32
  14. omega = generator**t
  15. assert omega != 1
  16. assert omega**(2**16) != 1
  17. assert omega**(2**31) != 1
  18. assert omega**(2**32) == 1
  19. return omega
  20. omega = get_omega()