From ab4e1b35c39c124a320bb98969b235dbd187bade Mon Sep 17 00:00:00 2001 From: Aurore Guillevic <aurore.guillevic@inria.fr> Date: Tue, 5 Sep 2023 22:24:58 +0200 Subject: [PATCH] another kss k=22 D=7 but with q=1 mod 11 possible --- sage/tnfs/curve/kss.py | 145 ++++++++++++++++++++++++++--------------- 1 file changed, 93 insertions(+), 52 deletions(-) diff --git a/sage/tnfs/curve/kss.py b/sage/tnfs/curve/kss.py index b724233..d682cf9 100644 --- a/sage/tnfs/curve/kss.py +++ b/sage/tnfs/curve/kss.py @@ -202,40 +202,58 @@ def polynomial_params(k, choice=None, D=None): cofactor_r = [1, 1] elif k == 22: if D is None or D == 7: - D = 7 - px = (x**24 - x**23 + 2*x**22 + 67*x**13 + 94*x**12 + 134*x**11 + 2048*x**2 + 5197*x + 4096)/7406 - rx = (x**20 - x**19 - x**18 + 3*x**17 - x**16 - 5*x**15 + 7*x**14 + 3*x**13 - 17*x**12 + 11*x**11 + 23*x**10 + 22*x**9 - 68*x**8 + 24*x**7 + 112*x**6 - 160*x**5 - 64*x**4 + 384*x**3 - 256*x**2 - 512*x + 1024)/23 # and sometimes / 23^2 - cx = (x**2 - x + 2) * (x**2 + x + 2) / (2 * 7 * 23) - tx = (x**12 + 45*x + 46)/46 - yx = (x**12 - 4*x**11 - 47*x - 134)/322 - m = 161 - # D = 7 = 3 mod 4 -> Chi = x**2 + x + 2 has roots (-1+sqrt(-7))/2 and (-1 - sqrt(-7))/2 - betax = (11*x**23 - 20*x**22 + 53*x**21 - 58*x**20 + 106*x**19 - 116*x**18 + 212*x**17 - 232*x**16 + 424*x**15 - 464*x**14 + 848*x**13 - 191*x**12 + 1322*x**11 + 1051*x**10 - 172*x**9 + 2102*x**8 - 344*x**7 + 4204*x**6 - 688*x**5 + 8408*x**4 - 1376*x**3 + 16816*x**2 + 19776*x + 36142)/18515 # mod p - lambx = (x**11 + 22)/23 # mod r - if choice is None or choice == 0: - u_mod_m = [32, 151] # and 7 | cxa = (x^2 - 2*x + 8) -> 2*u = 1 mod 7, 2*u mod 23 = [3, 18] - else: - u_mod_m = [4,18,25,39,81,95,116,123,144] # and 7 | cxa -> 2*u = 1 mod 7, 2*u mod 23 = [1, 8, 6, 13, 4, 2, 9, 16, 12] - rx = rx/23 - cx = cx*23 - #px = (x**24 - 2*x**23 + 8*x**22 + 137216*x**13 + 385024*x**12 + 1097728*x**11 + 8589934592*x**2 + 43595595776*x + 68719476736)/124252061696 - #rx = (x**20 - 2*x**19 - 4*x**18 + 24*x**17 - 16*x**16 - 160*x**15 + 448*x**14 + 384*x**13 - 4352*x**12 + 5632*x**11 + 23552*x**10 + 45056*x**9 - 278528*x**8 + 196608*x**7 + 1835008*x**6 - 5242880*x**5 - 4194304*x**4 + 50331648*x**3 - 67108864*x**2 - 268435456*x + 1073741824)/24117248 # and sometimes 554696704 - #cx = (x**2 - 2*x + 8) * (x**2 + 2*x + 8)/5152 - #tx = (x**12 + 92160*x + 188416)/188416 - #yx = (x**12 - 8*x**11 - 96256*x - 548864)/1318912 - #m = 322 - # Diskrep([2, 7, 23], {2: [(1, 0)], 7: [(1, 1), (1, 6)], 23: [(1, 1), (1, 2), (1, 3), (1, 4), (1, 6), (1, 8), (1, 9), (1, 12), (1, 13), (1, 16), (1, 18)]}) - #u_mod_m = [6, 8, 36, 48, 50, 62, 64, 78, 104, 118, 146, 162, 174, 188, 190, 202, 216, 232, 246, 288, 300, 302] - # if u_mod_m = [64, 302] (u=1 mod 7) then rx, px can take prime values. - # if u_mod_m = [118,202] (u=6 mod 7) then rx can take prime values but 7 | px and 7 | cb = (x**2 + 2*x + 8) - # if u_mod_m = [8,36,50,78,162,190,232,246,288] (u=1 mod 7) then rx/23 and px can take prime values - # if u_mod_m = [6,48,62,104,146,174,188,216,300] (u=6 mod 7) then rx/23 can take prime values but 7 | px and and 7 | cxb - #if choice is None or choice==0: - # u_mod_m = [64, 302] # and 7 | cxa = (x**2 - 2*x + 8) - #else: - # u_mod_m = [8,36,50,78,162,190,232,246,288] # and 7 | cxa -> u = 0 mod 2, u = 1 mod 7, u mod 23 = [8, 13, 4, 9, 1, 6, 2, 16, 12] - # rx = rx/23 - # cx = cx*23 + if choice is None or choice in [0,1]: + D = 7 + px = (x**24 - x**23 + 2*x**22 + 67*x**13 + 94*x**12 + 134*x**11 + 2048*x**2 + 5197*x + 4096)/7406 + rx = (x**20 - x**19 - x**18 + 3*x**17 - x**16 - 5*x**15 + 7*x**14 + 3*x**13 - 17*x**12 + 11*x**11 + 23*x**10 + 22*x**9 - 68*x**8 + 24*x**7 + 112*x**6 - 160*x**5 - 64*x**4 + 384*x**3 - 256*x**2 - 512*x + 1024)/23 # and sometimes / 23^2 + cx = (x**2 - x + 2) * (x**2 + x + 2) / (2 * 7 * 23) + tx = (x**12 + 45*x + 46)/46 + yx = (x**12 - 4*x**11 - 47*x - 134)/322 + m = 161 + # D = 7 = 3 mod 4 -> Chi = x**2 + x + 2 has roots (-1+sqrt(-7))/2 and (-1 - sqrt(-7))/2 + betax = (11*x**23 - 20*x**22 + 53*x**21 - 58*x**20 + 106*x**19 - 116*x**18 + 212*x**17 - 232*x**16 + 424*x**15 - 464*x**14 + 848*x**13 - 191*x**12 + 1322*x**11 + 1051*x**10 - 172*x**9 + 2102*x**8 - 344*x**7 + 4204*x**6 - 688*x**5 + 8408*x**4 - 1376*x**3 + 16816*x**2 + 19776*x + 36142)/18515 # mod p + lambx = (x**11 + 22)/23 # mod r + if choice is None or choice == 0: + u_mod_m = [32, 151] # and 7 | cxa = (x^2 - 2*x + 8) -> 2*u = 1 mod 7, 2*u mod 23 = [3, 18] + else: + u_mod_m = [4,18,25,39,81,95,116,123,144] # and 7 | cxa -> 2*u = 1 mod 7, 2*u mod 23 = [1, 8, 6, 13, 4, 2, 9, 16, 12] + rx = rx/23 + cx = cx*23 + #px = (x**24 - 2*x**23 + 8*x**22 + 137216*x**13 + 385024*x**12 + 1097728*x**11 + 8589934592*x**2 + 43595595776*x + 68719476736)/124252061696 + #rx = (x**20 - 2*x**19 - 4*x**18 + 24*x**17 - 16*x**16 - 160*x**15 + 448*x**14 + 384*x**13 - 4352*x**12 + 5632*x**11 + 23552*x**10 + 45056*x**9 - 278528*x**8 + 196608*x**7 + 1835008*x**6 - 5242880*x**5 - 4194304*x**4 + 50331648*x**3 - 67108864*x**2 - 268435456*x + 1073741824)/24117248 # and sometimes 554696704 + #cx = (x**2 - 2*x + 8) * (x**2 + 2*x + 8)/5152 + #tx = (x**12 + 92160*x + 188416)/188416 + #yx = (x**12 - 8*x**11 - 96256*x - 548864)/1318912 + #m = 322 + # Diskrep([2, 7, 23], {2: [(1, 0)], 7: [(1, 1), (1, 6)], 23: [(1, 1), (1, 2), (1, 3), (1, 4), (1, 6), (1, 8), (1, 9), (1, 12), (1, 13), (1, 16), (1, 18)]}) + #u_mod_m = [6, 8, 36, 48, 50, 62, 64, 78, 104, 118, 146, 162, 174, 188, 190, 202, 216, 232, 246, 288, 300, 302] + # if u_mod_m = [64, 302] (u=1 mod 7) then rx, px can take prime values. + # if u_mod_m = [118,202] (u=6 mod 7) then rx can take prime values but 7 | px and 7 | cb = (x**2 + 2*x + 8) + # if u_mod_m = [8,36,50,78,162,190,232,246,288] (u=1 mod 7) then rx/23 and px can take prime values + # if u_mod_m = [6,48,62,104,146,174,188,216,300] (u=6 mod 7) then rx/23 can take prime values but 7 | px and and 7 | cxb + #if choice is None or choice==0: + # u_mod_m = [64, 302] # and 7 | cxa = (x**2 - 2*x + 8) + #else: + # u_mod_m = [8,36,50,78,162,190,232,246,288] # and 7 | cxa -> u = 0 mod 2, u = 1 mod 7, u mod 23 = [8, 13, 4, 9, 1, 6, 2, 16, 12] + # rx = rx/23 + # cx = cx*23 + else: #elif choice in [2,3]: + D = 7 + px = (x**24 - 7*x**23 + 14*x**22 - 7**6*23*x**13 + 7**6*94*x**12 - 7**7*46*x**11 + 14**11*x**2 + 7**12*967*x + 14**12)/(2*7**12*67**2) + rx = (x**20 - 7*x**19 + 35*x**18 - 147*x**17 + 539*x**16 - 1715*x**15 + 4459*x**14 - 7203*x**13 - 12005*x**12 + 184877*x**11 - 1126069*x**10 + 2588278*x**9 - 2352980*x**8 - 19765032*x**7 + 171296944*x**6 - 922368160*x**5 + 4058419904*x**4 - 15495785088*x**3 + 51652616960*x**2 - 144627327488*x + 289254654976)/(7**10*67) + cx = (x**4 - 21*x**2 + 196)/6566 + tx = (-x**12 + 45*7**6*x + 134*7**6)/(2*7**6*67) + yx = (-x**12 + 4*x**11 + 47*7**5*x - 46*7**6)/(2*7**6*67) + betax = (x**23 - 16*x**22 + 91*x**21 - 350*x**20 + 1274*x**19 - 4900*x**18 + 17836*x**17 - 68600*x**16 + 249704*x**15 - 960400*x**14 + 3495856*x**13 - 16151527*x**12 + 44941918*x**11 - 87648505*x**10 + 418359844*x**9 - 1227079070*x**8 + 5857037816*x**7 - 17179106980*x**6 + 81998529424*x**5 - 240507497720*x**4 + 1147979411936*x**3 - 3367104968080*x**2 + 20121276936768*x - 39068021788194)/44381098746635# root of x^2+x+2 mod px + lambx = (x**11 - 114*7**5)/(7**5*67)# root of x^2+x+2 mod rx + m = 5159 + u_mod_m = [161, 1008, 1316, 1393, 2009, 2856, 2933, 3087, 3395, 3626, 4011] + if choice == 2: + u_mod_m = [2933, 3626] + else: + u_mod_m = [161, 1008, 1316, 1393, 2009, 2856, 3087, 3395, 4011] + rx = rx/67 + cx = cx*67 elif D == 3: D = 3 px = (x**24 - 6*x**23 + 21*x**22 - 37431234*x**13 + 223805916*x**12 - 786055914*x**11 + 350277500542221*x**2 - 2087000802936846*x + 7355827511386641)/267191528688 @@ -574,19 +592,35 @@ def poly_cofactor_twist_g1_g2(k, choice=None, D=None): assert (E2_order % rx) == 0 g2cx = E2_order // rx # reducible with 3 factors if D is None or D == 7: - m = 161 - cxa = (x**2 - x + 2)/7 - cxb = (x**2 + x + 2) - g2cxa = (x**2 + x + 2) - g2cxb = (x**22 - 2*x**21 + 2*x**20 + 2*x**19 - 6*x**18 + 2*x**17 + 10*x**16 - 14*x**15 - 6*x**14 + 34*x**13 - 22*x**12 + 21*x**11 + 278*x**10 - 186*x**9 - 370*x**8 + 742*x**7 - 2*x**6 - 1482*x**5 + 1486*x**4 + 1478*x**3 - 4450*x**2 + 1494*x + 9454)/(7 * 23) - if choice is None or choice==0: - u_m = [32, 151] - cxb = cxb/23 - g2cxa = g2cxa/23 - else: - u_m = [4,18,25,39,81,95,116,123,144] - g2cxb = g2cxb/23 - g2cxc = g2cx//(g2cxa*g2cxb) + if choice is None or choice in [0, 1]: + m = 161 + cxa = (x**2 - x + 2)/7 + cxb = (x**2 + x + 2) + g2cxa = (x**2 + x + 2) + g2cxb = (x**22 - 2*x**21 + 2*x**20 + 2*x**19 - 6*x**18 + 2*x**17 + 10*x**16 - 14*x**15 - 6*x**14 + 34*x**13 - 22*x**12 + 21*x**11 + 278*x**10 - 186*x**9 - 370*x**8 + 742*x**7 - 2*x**6 - 1482*x**5 + 1486*x**4 + 1478*x**3 - 4450*x**2 + 1494*x + 9454)/(7 * 23) + if choice is None or choice == 0: + u_m = [32, 151] + cxb = cxb/23 + g2cxa = g2cxa/23 + else: + u_m = [4,18,25,39,81,95,116,123,144] + g2cxb = g2cxb/23 + g2cxc = g2cx//(g2cxa*g2cxb) + else: # if choice in [2, 3]: + m = 5159 + # cx divided by 2 * 7^2 * 67 + cxa = (x**2 - 7*x + 14)/14 + cxb = (x**2 + 7*x + 14)/7 + g2cxa = (x**2 + 7*x + 14)/14 + g2cxb = (x**22 - 14*x**21 + 98*x**20 - 490*x**19 + 2058*x**18 - 7546*x**17 + 24010*x**16 - 62426*x**15 + 100842*x**14 + 168070*x**13 - 2588278*x**12 + 13059039*x**11 - 52000858*x**10 + 143296482*x**9 - 275063362*x**8 - 80707214*x**7 + 4415837566*x**6 - 29780961966*x**5 + 146645007838*x**4 - 609581587342*x**3 + 2214041001662*x**2 - 6964144788846*x + 21802004668318)/(7**11*67) + if choice == 2: + u_m = [2933, 3626] + cxb = cxb/67 + g2cxa = g2cxa/67 + else: + u_m = [161, 1008, 1316, 1393, 2009, 2856, 3087, 3395, 4011] + g2cxb = g2cxb/67 + g2cxc = g2cx//(g2cxa*g2cxb) elif D == 3: cxa = (x**2 - 6*x + 21)/12 cxb = (x**2 + 6*x + 21)/84 @@ -795,11 +829,18 @@ def congruence_constraints(k, choice=None, D=None): cofactor_r = [1, 1] elif k == 22: if D is None or D == 7: - m = 161 - if choice is None or choice == 0: - u_m = [32, 151] - else: - u_m = [4,18,25,39,81,95,116,123,144] + if choice is None or choice in [0,1]: + m = 161 + if choice is None or choice == 0: + u_m = [32, 151] + else: + u_m = [4,18,25,39,81,95,116,123,144] + else: # choice in [2,3] + m = 5159 + if choice == 2: + u_m = [2933, 3626] + else: + u_m = [161, 1008, 1316, 1393, 2009, 2856, 3087, 3395, 4011] elif D == 3: m = 2814 if choice is None or choice == 0: -- GitLab