Esempio n. 1
0
 def from_json_dict(
         json_dict: Dict[str, Any]) -> Groth16.VerificationKey:
     return Groth16.VerificationKey(
         alpha=G1Point.from_json_list(json_dict["alpha"]),
         beta=G2Point.from_json_list(json_dict["beta"]),
         delta=G2Point.from_json_list(json_dict["delta"]),
         abc=[G1Point.from_json_list(abc) for abc in json_dict["ABC"]])
Esempio n. 2
0
 def from_json_dict(
         json_dict: Dict[str, Any]) -> PGHR13.VerificationKey:
     return PGHR13.VerificationKey(
         a=G2Point.from_json_list(json_dict["a"]),
         b=G1Point.from_json_list(json_dict["b"]),
         c=G2Point.from_json_list(json_dict["c"]),
         g=G2Point.from_json_list(json_dict["g"]),
         gb1=G1Point.from_json_list(json_dict["gb1"]),
         gb2=G2Point.from_json_list(json_dict["gb2"]),
         z=G2Point.from_json_list(json_dict["z"]),
         ic=[G1Point.from_json_list(ic) for ic in json_dict["ic"]])
Esempio n. 3
0
 def from_json_dict(json_dict: Dict[str, Any]) -> PGHR13.Proof:
     return PGHR13.Proof(a=G1Point.from_json_list(json_dict["a"]),
                         a_p=G1Point.from_json_list(json_dict["a_p"]),
                         b=G2Point.from_json_list(json_dict["b"]),
                         b_p=G1Point.from_json_list(json_dict["b_p"]),
                         c=G1Point.from_json_list(json_dict["c"]),
                         c_p=G1Point.from_json_list(json_dict["c_p"]),
                         h=G1Point.from_json_list(json_dict["h"]),
                         k=G1Point.from_json_list(json_dict["k"]))
Esempio n. 4
0
 def _do_test_g2_proto_encode_decode(self, g2: G2Point) -> None:
     g2_proto = ec_group_messages_pb2.Group2Point()
     g2_point_to_proto(g2, g2_proto)
     g2_decoded = g2_point_from_proto(g2_proto)
     self.assertEqual(g2.to_json_list(), g2_decoded.to_json_list())
Esempio n. 5
0
 def test_g2_proto_encode_decode(self) -> None:
     self._do_test_g2_proto_encode_decode(
         G2Point(["0xaabbccdd"], ["0x11223344"]))
     self._do_test_g2_proto_encode_decode(
         G2Point(
             ["0xcdeeff00", "0x11223344"], ["0x55667788", "0x99aabbcc"]))
Esempio n. 6
0
 def from_json_dict(json_dict: Dict[str, Any]) -> Groth16.Proof:
     return Groth16.Proof(a=G1Point.from_json_list(json_dict["a"]),
                          b=G2Point.from_json_list(json_dict["b"]),
                          c=G1Point.from_json_list(json_dict["c"]))
Esempio n. 7
0
ALT_BN128_G1_8 = G1Point.from_json_list([
    "0x08b1d51d23480c10f472f5e93b9cfea88238c121fe155af7043937882c306a63",
    "0x299836713dad3fa34e337aa412466015c366af8ec50b9d7bd05aa74642822021"
])

ALT_BN128_G1_MINUS_8 = G1Point.from_json_list([
    "0x08b1d51d23480c10f472f5e93b9cfea88238c121fe155af7043937882c306a63",
    "0x06cc1801a38460866a1ccb126f3af847d41abb02a3662d116bc5e4d095fadd26"
])

ALT_BN128_G2_MINUS_1 = G2Point.from_json_list(
    [[
        "0x198e9393920d483a7260bfb731fb5d25f1aa493335a9e71297e485b7aef312c2",
        "0x1800deef121f1e76426a00665e5c4479674322d4f75edadd46debd5cd992f6ed"
    ],
     [
         "0x275dc4a288d1afb3cbb1ac09187524c7db36395df7be3b99e673b13a075a65ec",
         "0x1d9befcd05a5323e6da4d435f3b617cdb3af83285c2df711ef39c01571827f9d"
     ]])

ALT_BN128_G2_8 = G2Point.from_json_list(
    [[
        "0x03589520df85791604b5a2b720a21139aabdb41949d47779484b0db588bfa699",
        "0x18afc7fd8df1c902383c213b6d989f0066b7eca1388be49721792278984d9a29"
    ],
     [
         "0x2cc25982f4a3b75f57f8f3e966d75e6da8c51776bf0828c7ce3f10171793cd2a",
         "0x17623e9e90176bcdf8454daa96008240b12709ca5d79de805744cfd137609bec"
     ]])