You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

81 lines
3.0 KiB

4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
  1. use ark_ff::{
  2. fields::fp3::{Fp3, Fp3Config},
  3. AdditiveGroup, Field, MontFp,
  4. };
  5. use crate::fq::Fq;
  6. pub type Fq3 = Fp3<Fq3Config>;
  7. pub struct Fq3Config;
  8. impl Fp3Config for Fq3Config {
  9. type Fp = Fq;
  10. const NONRESIDUE: Fq = MontFp!("11");
  11. const TWO_ADICITY: u32 = 30;
  12. #[rustfmt::skip]
  13. const TRACE_MINUS_ONE_DIV_TWO: &'static [u64] = &[
  14. 15439605736802142541,
  15. 18190868848461853149,
  16. 6220121510046940818,
  17. 10310485528612680366,
  18. 5032137869959796540,
  19. 3943048799800510054,
  20. 1971151279016362045,
  21. 6096644900171872841,
  22. 12908407994230849218,
  23. 4163225373804228290,
  24. 10382959950522770522,
  25. 9008828410264446883,
  26. 18411821899404157689,
  27. 12386199240837247984,
  28. 13370099281150720481,
  29. 11909278545073807560,
  30. 5964354403900302648,
  31. 15347506722065009035,
  32. 7045354120681109597,
  33. 14294096902719509929,
  34. 6180325033003959541,
  35. 14381489272445870003,
  36. 18159920240207503954,
  37. 17487026929061632528,
  38. 12314108197538755669,
  39. 12116872703077811769,
  40. 3401400733784294722,
  41. 13905351619889935522,
  42. 10972472942574358218,
  43. 6104159581753028261,
  44. 4690139121547787552,
  45. 4880965491878697414,
  46. 1926648890365125214,
  47. 13532564555356297305,
  48. 3114545746551080,
  49. ];
  50. /// (11^T, 0, 0)
  51. const QUADRATIC_NONRESIDUE_TO_T: Fq3 = Fq3::new(
  52. MontFp!("22168644070733283197994897338612733221095941481265408161807376791727499343083607817089033595478370212662133368413166734396127674284827734481031659015434501966360165723728649019457855887066657739809176476252080335185730833468062"),
  53. Fq::ZERO,
  54. Fq::ZERO,
  55. );
  56. // Coefficients for the Frobenius automorphism.
  57. // c1[0] = 1,
  58. // c1[1] = 24129022407817241407134263419936114379815707076943508280977368156625538709102831814843582780138963119807143081677569721953561801075623741378629346409604471234573396989178424163772589090105392407118197799904755622897541183052132
  59. // c1[2] = 17769468560101711995209951371304522748355002843010440790806134764399814103468274958215310983651375801610927890210888755369611256415970113691066895445191924931148019336171640277697829047741006062493737919155152541323243293107868,
  60. const FROBENIUS_COEFF_FP3_C1: &'static [Fq] = &[
  61. Fq::ONE,
  62. MontFp!("24129022407817241407134263419936114379815707076943508280977368156625538709102831814843582780138963119807143081677569721953561801075623741378629346409604471234573396989178424163772589090105392407118197799904755622897541183052132"),
  63. MontFp!("17769468560101711995209951371304522748355002843010440790806134764399814103468274958215310983651375801610927890210888755369611256415970113691066895445191924931148019336171640277697829047741006062493737919155152541323243293107868"),
  64. ];
  65. // c2 = {c1[0], c1[2], c1[1]}
  66. const FROBENIUS_COEFF_FP3_C2: &'static [Fq] = &[
  67. Fq::ONE,
  68. Self::FROBENIUS_COEFF_FP3_C1[2],
  69. Self::FROBENIUS_COEFF_FP3_C1[1],
  70. ];
  71. }