//Definition of the extension fields Fq := F3(U) and Fq3 := Fq(V) q := 3^4; F3 := FiniteField(3); P3 := PolynomialRing(F3); poly := u^4 + u^2 + 2; Fq := ext; Pq := PolynomialRing(Fq); poly := v^3 + v + U^2 + U; Fq3 := ext; Pq3 := PolynomialRing(Fq3); r := 33098280119090191028775580055082175056428495623; Fr := GF(r); h0 := V^326196*Z^2 + V^35305*Z + V^204091; h0q := Evaluate(h0,Z^q); F := Z - h0q; Ix := Factorization(F)[2][1]; Fn := ext; N := #Fn - 1; // Generator of GF(3^{12*137})^* g := X + V^113713; // Encoding pi Re := RealField(2000); pival :=Pi(Re); hp := 0; for i := 0 to 136 do hp := hp + V^(Floor(pival*(#Fq3)^(i+1)) mod #Fq3)*(X^i); end for; // This is the logarithm challenge cofactor := N div r; h := hp^cofactor; // log_g(h) mod r is: x := 27339619076975093920245515973214186963025656559; // Define the exponent y to be used in the verification: y := IntegerRing()!(Fr!(x/cofactor)); // Check that h = (g^cofactor)^y h eq (g^cofactor)^y;