Exemple #1
0
def verify(SIG, m, W):
    HM = BLS_H(m)
    D = ECp()
    D.fromBytes(SIG)
    if D.isinf() :
        return False
    if not (curve.r*D).isinf() :
        return False
    D = -D

    PK = ECp2()
    PK.fromBytes(W)


    # Use new multi-pairing mechanism
    r = pair.initmp()
    pair.another_pc(r, G2_TAB, D)
    pair.another(r, PK, HM)
    v = pair.miller(r)

    #.. or alternatively
    #    G=ecp2.generator()
    #    if G.isinf() :
    #        return False
    #    v = pair.double_ate(G, D, PK, HM)

    v = pair.fexp(v)
    if v.isone():
        return True
    return False
def verify(SIG,m,W):
    HM=BLS_H(m)
    G=ecp2.generator()
    D=ECp()
    D.fromBytes(SIG)
    PK=ECp2()
    PK.fromBytes(W)
    D=-D

# Use new multi-pairing mechanism 
    r=pair.initmp()
    pair.another(r,G,D)
    pair.another(r,PK,HM)
    v=pair.miller(r)

#.. or alternatively
#    v = pair.double_ate(G, D, PK, HM)
    
    v = pair.fexp(v)
    if v.isone():
        return True
    return False
Exemple #3
0
def verify(SIG, m, W):
    HM = BLS_H(m)
    G = ecp2.generator()
    D = ECp()
    D.fromBytes(SIG)
    PK = ECp2()
    PK.fromBytes(W)
    D = -D

    # Use new multi-pairing mechanism
    r = pair.initmp()
    pair.another(r, G, D)
    pair.another(r, PK, HM)
    v = pair.miller(r)

    #.. or alternatively
    #    v = pair.double_ate(G, D, PK, HM)

    v = pair.fexp(v)
    if v.isone():
        return True
    return False