# Eve The Magician Does A Quantum Robust Trick — Learning With Errors

Jun 12 · 4 min read

## How did she do it?

`C:\Python27> python lwe.pyPublic key [37, 52, 72, 92, 22, 42, 67, 27, 47, 62]Selected values [22, 72, 42, 37, 47]Message to send: 0Sum is: 220Encrypted is: 220Message is 0C:\Python27>python lwe.pyPublic key [37, 52, 72, 92, 22, 42, 67, 27, 47, 62]Selected values [22, 62, 67, 52, 37]Message to send: 0Sum is: 240Encrypted is: 240Message is 0C:\Python27>python lwe.pyPublic key [37, 52, 72, 92, 22, 42, 67, 27, 47, 62]Selected values [92, 62, 22, 72, 67]Message to send: 1Sum is: 315Encrypted is: 316Message received is 1C:\Python27> python lwe.pyPublic key [37, 52, 72, 92, 22, 42, 67, 27, 47, 62]Selected values [42, 47, 37, 22, 62]Message to send: 1Sum is: 210Encrypted is: 211Message received is 1`
`import sysimport numpy as npimport randompublic_key=[]vals = [5, 8, 12, 16, 2, 6, 11, 3, 7, 10]s = 5e = 12message = 1file='1111'val=0for x in range(0,len(vals)):public_key.append(vals[x]*s+e)res = random.sample(public_key, 5)print "Public key",public_keyprint "Selected values",ressum = np.sum(res)print "Message to send:",messageprint 'Sum is:',sumif (message==1):sum=sum+1print 'Encrypted is:',sumrem = sum % sif (rem%2==0):print 'Message received is 0'else:print 'Message received is 1'`

Written by