def verify(x, t, y, pi, errorOnFail=True):
<EOL>p,c,u = pi<EOL>assertType(x, G1Element)<EOL>assertType(y, GtElement)<EOL>assertType(p, G1Element)<EOL>assertScalarType(c)<EOL>assertScalarType(u)<EOL>Q = generatorG1()<EOL>beta = pair(x,hashG2(t))<EOL>t1 = Q*u + p*c <EOL>t2 = beta**u * y**c<EOL>t1.normalize()<EOL>cPrime = hashZ(Q,p,beta,y,t1,t2)<EOL>if cPrime == c:<EOL><INDENT>return True<EOL><DEDENT>if errorOnFail:<EOL><INDENT>raise Exception("<STR_LIT>")<EOL><DEDENT>else:<EOL><INDENT>return False<EOL><DEDENT>
Verifies a zero-knowledge proof where p \in G1.
@errorOnFail: Raise an exception if the proof does not hold.