Ring Signature - Implementation

Implementation

Here a Python implementation of the original paper using RSA.

import os,hashlib,random,Crypto.PublicKey.RSA class ring: def __init__(self,k,l=1024): self.k = k self.l,self.n,self.q = l,len(k),1<Sign and verify two messages in a four users ring:

size,msg1,msg2 = 4,'hello','world!' r = ring(map(lambda _:Crypto.PublicKey.RSA.generate(1024, os.urandom),range(size))) for i in range(size): s1,s2 = r.sign(msg1,i),r.sign(msg2,i) assert r.verify(msg1,s1) and r.verify(msg2,s2) and not r.verify(msg1,s2)

Read more about this topic:  Ring Signature