def checkvalid(s, m, pk):
if len(s) != b // <NUM_LIT:4>:<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>if len(pk) != b // <NUM_LIT:8>:<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>R = decodepoint(s[:b // <NUM_LIT:8>])<EOL>A = decodepoint(pk)<EOL>S = decodeint(s[b // <NUM_LIT:8>:b // <NUM_LIT:4>])<EOL>h = Hint(encodepoint(R) + pk + m)<EOL>(x1, y1, z1, t1) = P = scalarmult_B(S)<EOL>(x2, y2, z2, t2) = Q = edwards_add(R, scalarmult(A, h))<EOL>if (not isoncurve(P) or not isoncurve(Q) or<EOL>(x1*z2 - x2*z1) % q != <NUM_LIT:0> or (y1*z2 - y2*z1) % q != <NUM_LIT:0>):<EOL><INDENT>raise SignatureMismatch("<STR_LIT>")<EOL><DEDENT>
Not safe to use when any argument is secret.

See module docstring.  This function should be used only for
verifying public signatures of public messages.