def dencrypt(M,bs,d,n): a=[] c="" i=0 end=len(M[0]) while i<end: if(i!=end-1): c=make(str(Pow.resMod(int(M[0][i]),d,n)),bs) else: c=make(str(Pow.resMod(int(M[0][i]),d,n)),M[1]) a.append(c) i+=1 return a
def encrypt(M,bs,e,n): f=make(str(M),3) i=0 batches=split(f,bs)[0] tail=split(f,bs)[1] while i<len(batches): batches[i]=str(Pow.resMod(int(batches[i]),e,n)) i+=1 return [batches, tail]