def spend(s_in): if not isinstance(s_in, SpendInput): raise TypeError s = s_in.s CO1 = G * s f = F(s_in.KI, s_in.PK, s_in.CO, CO1, s_in.m) sub_C, sub_f = sub(f) for i in range(len(s_in.sk)): s += s_in.sk[i].r * sub_f[i] sigma1 = prove2(sub_C, s_in.ii, s, s_in.base, s_in.exponent) r1 = [s_in.sk[i].r1 for i in range(len(s_in.sk))] sigma2 = multisig.sign(str(sigma1) + str(f), r1) return SpendProof(s_in.base, s_in.exponent, CO1, sigma1, sigma2)
def test_2_bad(self): x = [random_scalar()]*2 X = [random_point() for i in x] m = hash_to_scalar('test message') with self.assertRaises(ArithmeticError): multisig.verify(m,X,multisig.sign(m,x))
def test_2_order(self): x = [random_scalar()]*2 X = list(reversed([G*i for i in x])) m = hash_to_scalar('test message') multisig.verify(m,X,multisig.sign(m,x))
def test_2(self): x = [random_scalar()]*2 X = [G*i for i in x] m = hash_to_scalar('test message') multisig.verify(m,X,multisig.sign(m,x))