2.13.ipv8.attestation.wallet.pengbaorange.boudot

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).

Module Contents

Classes

Functions

2.13.ipv8.attestation.wallet.pengbaorange.boudot.secure_randint(nmin: int, nmax: int) int

Generate a secure random integer.

2.13.ipv8.attestation.wallet.pengbaorange.boudot._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.

2.13.ipv8.attestation.wallet.pengbaorange.boudot._siunpack(buf: bytes, amount: int) tuple[Iterator[int], bytes]

Unpack a given number of integer values from a buffer, packed with _sipack().

class 2.13.ipv8.attestation.wallet.pengbaorange.boudot.EL(c: int, D: int, D1: int, D2: int)

Proof that two commitments hide the same secret.

classmethod create(x: int, r1: int, r2: int, g1: 2.13.ipv8.attestation.wallet.primitives.value.FP2Value, h1: 2.13.ipv8.attestation.wallet.primitives.value.FP2Value, g2: 2.13.ipv8.attestation.wallet.primitives.value.FP2Value, h2: 2.13.ipv8.attestation.wallet.primitives.value.FP2Value, b: int, bitspace: int, t: int = 80, l: int = 40) EL

Create a new commitment that allows one to prove knowledge of secret integers x, r1 and r2.

check(g1: 2.13.ipv8.attestation.wallet.primitives.value.FP2Value, h1: 2.13.ipv8.attestation.wallet.primitives.value.FP2Value, g2: 2.13.ipv8.attestation.wallet.primitives.value.FP2Value, h2: 2.13.ipv8.attestation.wallet.primitives.value.FP2Value, y1: 2.13.ipv8.attestation.wallet.primitives.value.FP2Value, y2: 2.13.ipv8.attestation.wallet.primitives.value.FP2Value) bool

Check for equality with another commitment.

serialize() bytes

Convert this commitment to bytes.

classmethod unserialize(s: bytes) tuple[EL, bytes]

Convert bytes to a commitment.

__eq__(other: object) bool

Check if this object is equal to another object.

__hash__() int

Get the hash of this object. Always 6976 to enforce a “heavy” equality check.

__str__() str

Stringify this EL for printing.

class 2.13.ipv8.attestation.wallet.pengbaorange.boudot.SQR(F: 2.13.ipv8.attestation.wallet.primitives.value.FP2Value, el: EL)

Proof that a committed number is a square.

classmethod create(x: int, r1: int, g: 2.13.ipv8.attestation.wallet.primitives.value.FP2Value, h: 2.13.ipv8.attestation.wallet.primitives.value.FP2Value, b: int, bitspace: int) SQR

Create a new commitment that allows one to prove that the committed integer x is a square.

check(g: 2.13.ipv8.attestation.wallet.primitives.value.FP2Value, h: 2.13.ipv8.attestation.wallet.primitives.value.FP2Value, y: 2.13.ipv8.attestation.wallet.primitives.value.FP2Value) bool

Check for a committed square.

serialize() bytes

Convert this commitment to bytes.

classmethod unserialize(s: bytes) tuple[SQR, bytes]

Convert bytes to a commitment.

__eq__(other: object) bool

Check if this object is equal to another object.

__hash__() int

Get the hash of this object. Always 838182 to enforce a “heavy” equality check.

__str__() str

Stringify this EL for printing.