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>s = bytearray(s)<EOL>m = bytearray(m)<EOL>pk = bytearray(pk)<EOL>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 (<EOL>not isoncurve(P)<EOL>or not isoncurve(Q)<EOL>or (x1 * z2 - x2 * z1) % q != <NUM_LIT:0><EOL>or (y1 * z2 - y2 * z1) % q != <NUM_LIT:0><EOL>):<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.