// 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 := 589881151426658740854227725580736348850640632297373414091790995505756623268837; Fr := GF(r); h1 := Z^2 + V^530855; h1q := Evaluate(h1,Z^q); Ix := h1q*Z - 1; Fn := ext; N := #Fn - 1; // Generator of GF(3^{12*163})^* g := X + V^2; // Encoding pi Re := RealField(2000); pival :=Pi(Re); hp := 0; for i := 0 to 162 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 := 426395951498279193713291391953449000732592554251132525672039784356054526194343; // 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;