def pop_verify(pk: JacobianPoint, proof: JacobianPoint) -> bool: try: proof.check_valid() pk.check_valid() q = g2_map(bytes(pk), pop_scheme_pop_dst) one = Fq12.one(default_ec.q) pairing_result = ate_pairing_multi([pk, G1Generator().negate()], [q, proof]) return pairing_result == one except AssertionError: return False
def core_verify_mpl(pk: JacobianPoint, message: bytes, signature: JacobianPoint, dst: bytes) -> bool: try: signature.check_valid() pk.check_valid() except AssertionError: return False q = g2_map(message, dst) one = Fq12.one(default_ec.q) pairing_result = ate_pairing_multi([pk, G1Generator().negate()], [q, signature]) return pairing_result == one
def core_aggregate_verify(pks: List[JacobianPoint], ms: List[bytes], signature: JacobianPoint, dst: bytes) -> bool: if len(pks) != len(ms) or len(pks) < 1: return False try: signature.check_valid() qs = [signature] ps = [G1Generator().negate()] for i in range(len(pks)): pks[i].check_valid() qs.append(g2_map(ms[i], dst)) ps.append(pks[i]) return Fq12.one(default_ec.q) == ate_pairing_multi(ps, qs) except AssertionError: return False