Preview:
from Crypto.Util.number import *
def encrypt(m,e,n):
    return pow(m,e,n)
p=3
q=7
#to get n multiply two primes
n=p*q
#to get e pick a number 1 < e < f(n), with f representing euler's totient function
#e must also me coeprime to f(n) meaning gdf((fn), e) = 1
e=5
m1=bytes_to_long(b"test123")
m2=bytes_to_long(b"123test5")
assert (encrypt(m1,e,n)*encrypt(m2,e,n))%n==encrypt(m1*m2,e,n)
downloadDownload PNG downloadDownload JPEG downloadDownload SVG

Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!

Click to optimize width for Twitter