def ccs_dec(c0, c1, c2, g, h, h1, x1): ''' Decryption for CCS Cryptosystem ''' basis = pairing(g, h1) ct = pairing(c0 * x1 + ~c1, h) + pairing(g, c2) # Addition ou multiplication entre les deux pairings ? # TODO addition j'espère car sinon faut implémenter * dans F_12 :S m = __dlog(ct, basis) return m
def ccs_open(m, a, c2, g, h, h1): if pairing(a, h) == pairing(g, c2 + ~(h1 * m)): return m else: return None