from charm import toolbox
help(toolbox)
运行上述代码,查看charm库toolbox软件包下的pairinggroup的使用说明
Help on module charm.toolbox.pairinggroup in charm.toolbox:
NAME
charm.toolbox.pairinggroup
CLASSES
builtins.object
PairingGroup
pairing.Element
pairing.Pairing
class PairingGroup(builtins.object)
| PairingGroup(param_id, param_file=False, secparam=512, verbose=False)
|
| Methods defined here:
|
| EndBenchmark(self)
| ends an ongoing benchmark
|
| GetBenchmark(self, option)
| retrieves benchmark results for any of these options:
| RealTime, CpuTime, Mul, Div, Add, Sub, Exp, Pair, Granular
|
| GetGeneralBenchmarks(self)
| retrieves benchmark count for all group operations
|
| GetGranularBenchmarks(self)
| retrieves group operation count per type: ZR, G1, G2, and GT
|
| InitBenchmark(self)
| initiates the benchmark state
|
| StartBenchmark(self, options)
| starts the benchmark with any of these options:
| RealTime, CpuTime, Mul, Div, Add, Sub, Exp, Pair, Granular
|
| __init__(self, param_id, param_file=False, secparam=512, verbose=False)
| Initialize self. See help(type(self)) for accurate signature.
|
| __str__(self)
| Return str(self).
|
| debug(self, data, prefix=None)
|
| decode(self, element)
|
| deserialize(self, obj, compression=True)
| Deserialize a bytes serialized element into a pairing object.
|
| :param compression: must be used for objects serialized with the
| compression parameter set to True. Default is True for
| compatibility with previous versions of charm.
|
| encode(self, message)
|
| groupSetting(self)
|
| groupType(self)
|
| hash(self, args, type=0)
| hashes objects into ZR, G1 or G2 depending on the pairing curve
|
| init(self, type, value=None)
| initializes an object with a specified type and value
|
| ismember(self, obj)
| membership test for a pairing object
|
| ismemberDict(self, obj)
| membership test for a dict of pairing objects
|
| ismemberList(self, obj)
| membership test for a list of pairing objects
|
| messageSize(self)
|
| order(self)
| returns the order of the group
|
| pair_prod(self, lhs, rhs)
| takes two lists of G1 & G2 and computes a pairing product
|
| paramgen(self, qbits, rbits)
|
| random(self, _type=0, count=1, seed=None)
| selects a random element in ZR, G1, G2 and GT
|
| serialize(self, obj, compression=True)
| Serialize a pairing object into bytes.
|
| :param compression: serialize the compressed representation of the
| curve element, taking about half the space but potentially
| incurring in non-negligible computation costs when
| deserializing. Default is True for compatibility with previous
| versions of charm.
|
| >>> p = PairingGroup('SS512')
| >>> v1 = p.random(G1)
| >>> b1 = p.serialize(v1)
| >>> b1 == p.serialize(v1, compression=True)
| True
| >>> v1 == p.deserialize(b1)
| True
| >>> b1 = p.serialize(v1, compression=False)
| >>> v1 == p.deserialize(b1, compression=False)
| True
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| __dict__
| dictionary for instance variables (if defined)
|
| __weakref__
| list of weak references to the object (if defined)
pairing = class Pairing(builtins.object)
| Pairing group parameters
|
| Methods defined here:
|
| __init__(self, /, *args, **kwargs)
| Initialize self. See help(type(self)) for accurate signature.
|
| __repr__(self, /)
| Return repr(self).
|
| __str__(self, /)
| Return str(self).
|
| ----------------------------------------------------------------------
| Static methods defined here:
|
| __new__(*args, **kwargs) from builtins.type
| Create and return a new object. See help(type) for accurate signature.
pc_element = class Element(builtins.object)
| Pairing element objects
|
| Methods defined here:
|
| __add__(self, value, /)
| Return self+value.
|
| __eq__(self, value, /)
| Return self==value.
|
| __ge__(self, value, /)
| Return self>=value.
|
| __gt__(self, value, /)
| Return self>value.
|
| __hash__(self, /)
| Return hash(self).
|
| __iadd__(self, value, /)
| Return self+=value.
|
| __imul__(self, value, /)
| Return self*=value.
|
| __init__(self, /, *args, **kwargs)
| Initialize self. See help(type(self)) for accurate signature.
|
| __int__(self, /)
| int(self)
|
| __invert__(self, /)
| ~self
|
| __ipow__(self, value, /)
| Return self**=value.
|
| __isub__(self, value, /)
| Return self-=value.
|
| __itruediv__(self, value, /)
| Return self/=value.
|
| __le__(self, value, /)
| Return self<=value.
|
| __lt__(self, value, /)
| Return self<value.
|
| __mul__(self, value, /)
| Return self*value.
|
| __ne__(self, value, /)
| Return self!=value.
|
| __neg__(self, /)
| -self
|
| __pow__(self, value, mod=None, /)
| Return pow(self, value, mod).
|
| __radd__(self, value, /)
| Return value+self.
|
| __repr__(self, /)
| Return repr(self).
|
| __rmul__(self, value, /)
| Return value*self.
|
| __rpow__(self, value, mod=None, /)
| Return pow(value, self, mod).
|
| __rsub__(self, value, /)
| Return value-self.
|
| __rtruediv__(self, value, /)
| Return value/self.
|
| __str__(self, /)
| Return str(self).
|
| __sub__(self, value, /)
| Return self-value.
|
| __truediv__(self, value, /)
| Return self/value.
|
| initPP(...)
| Initialize the pre-processing field of element.
|
| set(...)
| Set an element to a fixed value.
|
| ----------------------------------------------------------------------
| Static methods defined here:
|
| __new__(*args, **kwargs) from builtins.type
| Create and return a new object. See help(type) for accurate signature.
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| initialized
| determine initialization status
|
| preproc
| determine pre-processing status
|
| type
| group type
FUNCTIONS
H(...)
Hash an element type to a specific field: Zr, G1, or G2
deserialize(...)
De-serialize an bytes object into an element object
extract_key(g)
Given a group element, extract a symmetric key
:param g:
:return:
hashPair(...)
Compute a sha1 hash of an element type
init(...)
Create an element in group Zr and optionally set value.
ismember(...)
Group membership test for element objects.
order(...)
Get the group order for a particular field.
pair(...)
Apply pairing between an element of G1 and G2 and returns an element mapped to GT
random(...)
Return a random element in a specific group: G1, G2, Zr
serialize(...)
Serialize an element type into bytes.
DATA
G1 = 1
G2 = 2
GT = 3
ZR = 0
libs = Enum('openssl', 'gmp', 'pbc', 'miracl', 'relic')
pairing_lib = pbc
param_info = {'BN254': 'type f\nq 162832625489976012201980081182398860...
FILE
/home/xue/crypto_pbc/lib/python3.8/site-packages/Charm_Crypto-0.50-py3.8-linux-x86_64.egg/charm/toolbox/pairinggroup.py