コード例 #1
0
    def ExtGen(self):
        #print("GS: Setup Binding")
        self.G = BpGroup()
        self.e = self.G.pair
        self.order = self.G.order()
        self.g1, self.g2 = self.G.gen1(), self.G.gen2()
        self.gt = self.e(self.g1, self.g2)
        self.P = (self.order, self.G, self.g1, self.g2, self.e)

        rho = self.order.random()
        xsi = self.order.random()
        self.v1 = [xsi * self.g1, self.g1]
        self.w1 = [rho * xsi * self.g1, rho * self.g1]
        self.u1 = [rho * xsi * self.g1, rho * self.g1 + self.g1]
        self.Xsi = [xsi.mod_inverse(self.order).int_neg(), 1]

        sigma = self.order.random()
        psi = self.order.random()
        self.v2 = [psi * self.g2, self.g2]
        self.w2 = [sigma * xsi * self.g2, sigma * self.g2]
        self.u2 = [sigma * xsi * self.g2, sigma * self.g2 + self.g2]
        self.Psi = [psi.mod_inverse(self.order).int_neg(), 1]

        self.ck = (self.order, self.G, self.u1, self.v1, self.w1, self.u2,
                   self.v2, self.w2)
        self.xk = (self.ck, self.Xsi, self.Psi)

        return (self.ck, self.xk, self.P)
コード例 #2
0
 def setup(self):
     """Generates the Bilinear param"""
     #print("BSPS: setup")
     G = BpGroup()
     g1, g2 = G.gen1(), G.gen2()
     e, o = G.pair, G.order()
     return (o, G, g1, g2, e)
コード例 #3
0
	def params_gen(self):
		"""Generates the AHEG for an EC group nid"""
		print("CCA2EG: Setup")
		G = BpGroup()
		g1, g2 = G.gen1(), G.gen2()
		e, o = G.pair, G.order()
		return (G, g1, o)
コード例 #4
0
 def params_gen(self):
     """Generates the AHEG for an EC group nid"""
     print("CCA2EG: Setup")
     G = BpGroup()
     g1 = G.gen1()
     o = G.order()
     g2 = o.random() * g1
     return [o, G, g1, g2]
コード例 #5
0
def setup(q=1):
    """ generate all public parameters """
    assert q > 0
    G = BpGroup()
    g1, g2 = G.gen1(), G.gen2()
    hs = [G.hashG1(("h%s" % i).encode("utf8")) for i in range(q)]
    e, o = G.pair, G.order()
    return (G, o, g1, hs, g2, e)
コード例 #6
0
def setup():
	"""
	Generate the public parameters.

	Returns:
		- params: the publc parameters
	"""
	G = BpGroup()
	(g1, g2) = G.gen1(), G.gen2()
	(e, o) = G.pair, G.order()
	return (G, o, g1, g2, e)
コード例 #7
0
ファイル: scheme.py プロジェクト: jmanya05/coconut
def setup(q=1):
    """
	Generate the public parameters. 

	Parameters:
		- `q` (integer): the maximum number of attributes that can be embbed in the credentials

	Returns:
		- params: the publc parameters
	"""
    assert q > 0
    G = BpGroup()
    (g1, g2) = G.gen1(), G.gen2()
    hs = [G.hashG1(("h%s" % i).encode("utf8")) for i in range(q)]
    (e, o) = G.pair, G.order()
    return (G, o, g1, hs, g2, e)
コード例 #8
0
def setup(q=1):
    """
    Generate the public parameters.

    Parameters:
        - `q` (integer): the maximum number of attributes that can be embbed in the credentials

    Returns:
        - params: the publc parameters
    """
    coco_ensure(q > 0, "Number of authorities must be positive.")
    G = BpGroup()
    (g1, g2) = G.gen1(), G.gen2()
    hs = [G.hashG1(("h%s" % i).encode("utf8")) for i in range(q)]
    h_blind = G.hashG1(("h_blind").encode("utf8"))
    (e, o) = G.pair, G.order()
    return (G, o, g1, hs, h_blind, g2, e)
コード例 #9
0
ファイル: elgamal.py プロジェクト: grnet/hat_shuffle
def gen_params_bp_g2(nid=713):
    G = BpGroup()
    g = G.gen2()
    o = G.order()
    return (G, g, o)
コード例 #10
0
ファイル: PSSig.py プロジェクト: musalbas/coconut
def setup():
    G = BpGroup()
    g1, g2 = G.gen1(), G.gen2()
    e, o = G.pair, G.order()
    return (G, o, g1, g2, e)
コード例 #11
0
def params():
    G = BpGroup()
    Zp = G.order()
    return (G, Zp)
コード例 #12
0
def setup():
	""" generate all public parameters """
	G = BpGroup()
	(g1, g2) = G.gen1(), G.gen2()
	(e, o) = G.pair, G.order()
	return (G, o, g1, g2, e)
コード例 #13
0
ファイル: test_pairings.py プロジェクト: zpleefly/zksk
def bp_group():
    return BpGroup()
コード例 #14
0
 def __init__(self, bp_group=None):
     if bp_group is None:
         self.bpgp = BpGroup()
     self.GT = GTGroup(self)
     self.G1 = G1Group(self)
     self.G2 = G2Group(self)
コード例 #15
0
ファイル: environment.py プロジェクト: CarlBeek/DSP
from bplib.bp import BpGroup
import sha3

G = BpGroup()
g1 = G.gen1()
g2 = G.gen2()
e = G.pair
o = G.order()


def hash(m):
    m = str(m)
    enc = m.encode('utf-8')
    return sha3.keccak_256(enc).digest()