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)
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)
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)
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]
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)
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)
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)
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)
def gen_params_bp_g2(nid=713): G = BpGroup() g = G.gen2() o = G.order() return (G, g, o)
def setup(): G = BpGroup() g1, g2 = G.gen1(), G.gen2() e, o = G.pair, G.order() return (G, o, g1, g2, e)
def params(): G = BpGroup() Zp = G.order() return (G, Zp)
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)
def bp_group(): return BpGroup()
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)
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()