(m, puk)
return pow(puk[1], r, puk[0]), m * pow(puk[2], r, puk[0]) % puk[0]
Encrypt message with public key

    m is plain text message in int. puk is
    public key (p, r, e). In order to encrypt
    a message, a random number ``a`` between ``2`` and ``p``,
    encryped message is `c_{1}` and `c_{2}`

    `c_{1} \equiv r^{a} \pmod p`

    `c_{2} \equiv m e^{a} \pmod p`

    Parameters
    ==========

    m : int of encoded message
    puk : public key

    Returns
    =======

    (c1, c2) : Encipher into two number

    Examples
    ========

    >>> from sympy.crypto.crypto import encipher_elgamal
    >>> encipher_elgamal(100, (1031, 14, 212))     # doctest: +SKIP
    (835, 271)
Encrypt message with public key
Encrypt message with public key
def encipher_elgamal(m, puk):
    """
    Encrypt message with public key

    m is plain text message in int. puk is
    public key (p, r, e). In order to encrypt
    a message, a random number ``a`` between ``2`` and ``p``,
    encryped message is `c_{1}` and `c_{2}`

    `c_{1} \equiv r^{a} \pmod p`

    `c_{2} \equiv m e^{a} \pmod p`

    Parameters
    ==========

    m : int of encoded message
    puk : public key

    Returns
    =======

    (c1, c2) : Encipher into two number

    Examples
    ========

    >>> from sympy.crypto.crypto import encipher_elgamal
    >>> encipher_elgamal(100, (1031, 14, 212))     # doctest: +SKIP
    (835, 271)

    """
    if m > puk[0]:
        ValueError('Message {} should be less than prime {}'.format(m, puk[0]))
    r = randrange(2, puk[0])
    return pow(puk[1], r, puk[0]), m * pow(puk[2], r, puk[0]) % puk[0]
def encipher_elgamal ( m , puk ) : if m > puk [ 0 ] : ValueError ( 'Message {} should be less than prime {}' . format ( m , puk [ 0 ] ) ) r = randrange ( 2 , puk [ 0 ] ) return pow ( puk [ 1 ] , r , puk [ 0 ] ) , m * pow ( puk [ 2 ] , r , puk [ 0 ] ) % puk [ 0 ]