Elgamal Encryption, Cybersecurity, Encryption, Cryptography.
bits=int(sys.argv[2]) p = Crypto.Util.number.getPrime(bits, randfunc=Crypto.Random.get_random_bytes) m = int.from_bytes(M.encode(),byteorder='big' ) g = primitive_root(p) x1 = random.randrange(3, p) Y1 = pow(g,x1,p) x2 = random.randrange(3, p) Y2 = pow(g,x2,p) r1=random.randrange(3, p)