3.0.ipv8.attestation.wallet.pengbaorange.boudot =============================================== .. py:module:: 3.0.ipv8.attestation.wallet.pengbaorange.boudot .. autoapi-nested-parse:: Implementation of proofs for checking commitment equality and if a commitment is a square ("Efficient Proofs that a Committed NumberLies in an Interval" by F. Boudot). Modified for use with range proofs ("An efficient range proof scheme." by K. Peng and F. Bao). Classes ------- .. autoapisummary:: 3.0.ipv8.attestation.wallet.pengbaorange.boudot.EL 3.0.ipv8.attestation.wallet.pengbaorange.boudot.SQR Functions --------- .. autoapisummary:: 3.0.ipv8.attestation.wallet.pengbaorange.boudot.secure_randint 3.0.ipv8.attestation.wallet.pengbaorange.boudot._sipack 3.0.ipv8.attestation.wallet.pengbaorange.boudot._siunpack Module Contents --------------- .. py:function:: secure_randint(nmin: int, nmax: int) -> int Generate a secure random integer. .. py:function:: _sipack(*n: int) -> bytes Pack a list of up to 8 ints to a bytes string, prepended with a byte for which each bit specifies if the packed int was negative. .. py:function:: _siunpack(buf: bytes, amount: int) -> tuple[collections.abc.Iterator[int], bytes] Unpack a given number of integer values from a buffer, packed with ``_sipack()``. .. py:class:: EL(c: int, D: int, D1: int, D2: int) Proof that two commitments hide the same secret. .. py:attribute:: c .. py:attribute:: D .. py:attribute:: D1 .. py:attribute:: D2 .. py:method:: create(x: int, r1: int, r2: int, g1: 3.0.ipv8.attestation.wallet.primitives.value.FP2Value, h1: 3.0.ipv8.attestation.wallet.primitives.value.FP2Value, g2: 3.0.ipv8.attestation.wallet.primitives.value.FP2Value, h2: 3.0.ipv8.attestation.wallet.primitives.value.FP2Value, b: int, bitspace: int, t: int = 80, l: int = 40) -> EL :classmethod: Create a new commitment that allows one to prove knowledge of secret integers x, r1 and r2. .. py:method:: check(g1: 3.0.ipv8.attestation.wallet.primitives.value.FP2Value, h1: 3.0.ipv8.attestation.wallet.primitives.value.FP2Value, g2: 3.0.ipv8.attestation.wallet.primitives.value.FP2Value, h2: 3.0.ipv8.attestation.wallet.primitives.value.FP2Value, y1: 3.0.ipv8.attestation.wallet.primitives.value.FP2Value, y2: 3.0.ipv8.attestation.wallet.primitives.value.FP2Value) -> bool Check for equality with another commitment. .. py:method:: serialize() -> bytes Convert this commitment to bytes. .. py:method:: unserialize(s: bytes) -> tuple[EL, bytes] :classmethod: Convert bytes to a commitment. .. py:method:: __eq__(other: object) -> bool Check if this object is equal to another object. .. py:method:: __hash__() -> int Get the hash of this object. Always 6976 to enforce a "heavy" equality check. .. py:method:: __str__() -> str Stringify this EL for printing. .. py:class:: SQR(F: 3.0.ipv8.attestation.wallet.primitives.value.FP2Value, el: EL) Proof that a committed number is a square. .. py:attribute:: F .. py:attribute:: el .. py:method:: create(x: int, r1: int, g: 3.0.ipv8.attestation.wallet.primitives.value.FP2Value, h: 3.0.ipv8.attestation.wallet.primitives.value.FP2Value, b: int, bitspace: int) -> SQR :classmethod: Create a new commitment that allows one to prove that the committed integer x is a square. .. py:method:: check(g: 3.0.ipv8.attestation.wallet.primitives.value.FP2Value, h: 3.0.ipv8.attestation.wallet.primitives.value.FP2Value, y: 3.0.ipv8.attestation.wallet.primitives.value.FP2Value) -> bool Check for a committed square. .. py:method:: serialize() -> bytes Convert this commitment to bytes. .. py:method:: unserialize(s: bytes) -> tuple[SQR, bytes] :classmethod: Convert bytes to a commitment. .. py:method:: __eq__(other: object) -> bool Check if this object is equal to another object. .. py:method:: __hash__() -> int Get the hash of this object. Always 838182 to enforce a "heavy" equality check. .. py:method:: __str__() -> str Stringify this EL for printing.