def test_bls_core(privkey): domain = 0 p1 = multiply(G1, privkey) p2 = multiply(G2, privkey) msg = str(privkey).encode('utf-8') msghash = hash_to_G2(msg, domain=domain) assert normalize(decompress_G1(compress_G1(p1))) == normalize(p1) assert normalize(decompress_G2(compress_G2(p2))) == normalize(p2) assert normalize(decompress_G2(compress_G2(msghash))) == normalize(msghash) sig = sign(msg, privkey, domain=domain) pub = privtopub(privkey) assert verify(msg, pub, sig, domain=domain)
def test_hash_to_G2(): message = b'helloworld' domain_1 = 1 result_1 = hash_to_G2(message, domain_1) assert is_on_curve(result_1, b2)
def test_hash_to_G2(): message_hash = b'\x12' * 32 domain_1 = 1 result_1 = hash_to_G2(message_hash, domain_1) assert is_on_curve(result_1, b2)