3.0.ipv8.attestation.wallet.pengbaorange.structs
Classes
Functions
Module Contents
- 3.0.ipv8.attestation.wallet.pengbaorange.structs._serialize_fp2value(value: 3.0.ipv8.attestation.wallet.primitives.value.FP2Value) bytes
Convert an FP2Value to bytes.
- 3.0.ipv8.attestation.wallet.pengbaorange.structs._unserialize_fp2value(mod: int, value: bytes) tuple[3.0.ipv8.attestation.wallet.primitives.value.FP2Value, bytes]
Decode serialized bytes back into an FP2Value of the given modulus.
- class 3.0.ipv8.attestation.wallet.pengbaorange.structs.PengBaoCommitment(c: 3.0.ipv8.attestation.wallet.primitives.value.FP2Value, c1: 3.0.ipv8.attestation.wallet.primitives.value.FP2Value, c2: 3.0.ipv8.attestation.wallet.primitives.value.FP2Value, ca: 3.0.ipv8.attestation.wallet.primitives.value.FP2Value, ca1: 3.0.ipv8.attestation.wallet.primitives.value.FP2Value, ca2: 3.0.ipv8.attestation.wallet.primitives.value.FP2Value, ca3: 3.0.ipv8.attestation.wallet.primitives.value.FP2Value, caa: 3.0.ipv8.attestation.wallet.primitives.value.FP2Value)
The proof structure that a commitment hides a value within a certain range.
- c
- c1
- c2
- ca
- ca1
- ca2
- ca3
- caa
- classmethod unserialize(s: bytes) tuple[PengBaoCommitment, bytes]
Convert bytes to a commitment.
- class 3.0.ipv8.attestation.wallet.pengbaorange.structs.PengBaoCommitmentPrivate(m1: int, m2: int, m3: int, r1: int, r2: int, r3: int)
Private part of the PengBaoCommitment.
- m1
- m2
- m3
- r1
- r2
- r3
- generate_response(s: int, t: int) tuple[int, int, int, int]
Given s and t and our private information, generate the appropriate response.
The calling function should make sure s and t are large integers (at least larger than 0).
- classmethod unserialize(s: bytes) tuple[PengBaoCommitmentPrivate, bytes]
Convert bytes to a commitment.
- encode(PK: 3.0.ipv8.attestation.wallet.primitives.structs.BonehPublicKey) bytes
Serialize and encode using a given public key.
- classmethod decode(SK: 3.0.ipv8.attestation.wallet.primitives.structs.BonehPrivateKey, s: bytes) PengBaoCommitmentPrivate
Decode an encoded PengBaoCommitmentPrivate using a secret key.
- class 3.0.ipv8.attestation.wallet.pengbaorange.structs.PengBaoPublicData(PK: 3.0.ipv8.attestation.wallet.primitives.structs.BonehPublicKey, bitspace: int, commitment: PengBaoCommitment, el: 3.0.ipv8.attestation.wallet.pengbaorange.boudot.EL, sqr1: 3.0.ipv8.attestation.wallet.pengbaorange.boudot.SQR, sqr2: 3.0.ipv8.attestation.wallet.pengbaorange.boudot.SQR)
Public data required to verify a Peng Bao proof.
- PK
- bitspace
- commitment
- el
- sqr1
- sqr2
- check(a: int, b: int, s: int, t: int, x: int, y: int, u: int, v: int) bool
Check whether the given range is correct.
- serialize() bytes
Serialize this Attestation to a string.
- Returns:
the serialized form of this attestation
- Return type:
- class 3.0.ipv8.attestation.wallet.pengbaorange.structs.PengBaoAttestation(publicdata: PengBaoPublicData, privatedata: PengBaoCommitmentPrivate | None, id_format: str | None = None)
Bases:
3.0.ipv8.attestation.identity_formats.AttestationAn attestation for a Peng Bao range proof.
- publicdata
- privatedata
- id_format
- PK
- serialize() bytes
Serialize this Attestation to a string.
- Returns:
the serialized form of this attestation
- Return type:
- serialize_private(PK: 3.0.ipv8.attestation.wallet.primitives.structs.BonehPublicKey) bytes
Serialize this Attestation to a string, include shared secrets (not to be published!).
- Parameters:
PK – the public key to encode for
- Returns:
the serialized form of this attestation
- Return type:
- classmethod unserialize(s: bytes, id_format: str | None = None) PengBaoAttestation
Given a string, create an Attestation object.
- Parameters:
- Returns:
the attestation object
- Return type:
- classmethod unserialize_private(SK: 3.0.ipv8.attestation.wallet.primitives.structs.BonehPrivateKey, s: bytes, id_format: str | None = None) PengBaoAttestation
Given a string, create an Attestation object. The input contains shared secrets not to be published.
- Parameters:
- Returns:
the attestation object
- Return type: