
    Lj4                      T   U d dl mZ d dlmZmZ d dlmZ  eej	                  Z
 ej                    Zeed<    ej                    Zeed<   d Zd Ze
r ej                    Z ej                    ZdedefdZded	edefd
ZdedefdZdedefdZded	edefdZded	edefdZdS )    )
exceptions)ffilib)ensurecrypto_scalarmult_BYTEScrypto_scalarmult_SCALARBYTESnreturnc                     t          j        dt                    }t          j        ||           }t          |dk    dt          j                   t          j        |t                    dd         S )z
    Computes and returns the scalar product of a standard group element and an
    integer ``n``.

    :param n: bytes
    :rtype: bytes
    unsigned char[]r   Unexpected library errorraisingN)
r   newr   r   crypto_scalarmult_baser   excRuntimeErrorbufferr   r	   qrcs      c/home/ice/.hermes/hermes-agent/venv/lib/python3.11/site-packages/nacl/bindings/crypto_scalarmult.pyr   r   $   sb     	!#:;;A		#Aq	)	)B
27.8HIIII:a677::    pc                     t          j        dt                    }t          j        || |          }t          |dk    dt          j                   t          j        |t                    dd         S )z
    Computes and returns the scalar product of the given group element and an
    integer ``n``.

    :param p: bytes
    :param n: bytes
    :rtype: bytes
    r   r   r   r   N)
r   r   r   r   crypto_scalarmultr   r   r   r   r   r	   r   r   r   s       r   r   r   4   sd     	!#:;;A		q!Q	'	'B
27.8HIIII:a677::r   c                    t          t          dt          j                   t          t	          | t
                    ot          |           t          k    d                    d          t          j	                   t          j        dt                    }t          j        ||           }t          |dk    dt          j                   t          j        |t                    dd         S )	a  
    Computes and returns the scalar product of a standard group element and an
    integer ``n`` on the edwards25519 curve.

    :param n: a :py:data:`.crypto_scalarmult_ed25519_SCALARBYTES` long bytes
              sequence representing a scalar
    :type n: bytes
    :return: a point on the edwards25519 curve, represented as a
             :py:data:`.crypto_scalarmult_ed25519_BYTES` long bytes sequence
    :rtype: bytes
    :raises nacl.exceptions.UnavailableError: If called when using a
        minimal build of libsodium.
    Not available in minimal buildr   &Input must be a {} long bytes sequence%crypto_scalarmult_ed25519_SCALARBYTESr   r   r   N)r   has_crypto_scalarmult_ed25519r   UnavailableError
isinstancebyteslenr!   format	TypeErrorr   r   crypto_scalarmult_ed25519_BYTESr   crypto_scalarmult_ed25519_baser   r   r   s      r   r*   r*   E   s     %($    1e 	<FF;;0773	
 	
     	!#BCCA		+Aq	1	1B
27.8HIIII:a899!!!<<r   c                    t          t          dt          j                   t          t	          | t
                    ot          |           t          k    d                    d          t          j	                   t          j        dt                    }t          j        ||           }t          |dk    dt          j                   t          j        |t                    dd         S )	a:  
    Computes and returns the scalar product of a standard group element and an
    integer ``n`` on the edwards25519 curve. The integer ``n`` is not clamped.

    :param n: a :py:data:`.crypto_scalarmult_ed25519_SCALARBYTES` long bytes
              sequence representing a scalar
    :type n: bytes
    :return: a point on the edwards25519 curve, represented as a
             :py:data:`.crypto_scalarmult_ed25519_BYTES` long bytes sequence
    :rtype: bytes
    :raises nacl.exceptions.UnavailableError: If called when using a
        minimal build of libsodium.
    r   r   r    r!   r   r   r   N)r   r"   r   r#   r$   r%   r&   r!   r'   r(   r   r   r)   r   &crypto_scalarmult_ed25519_base_noclampr   r   r   s      r   r,   r,   j   s     %($    1e 	<FF;;0773	
 	
     	!#BCCA		3Aq	9	9B
27.8HIIII:a899!!!<<r   c                    t          t          dt          j                   t          t	          | t
                    ot          |           t          k    d                    d          t          j	                   t          t	          |t
                    ot          |          t          k    d                    d          t          j	                   t          j        dt                    }t          j        || |          }t          |dk    dt          j                   t          j        |t                    d	d	         S )
aq  
    Computes and returns the scalar product of a *clamped* integer ``n``
    and the given group element on the edwards25519 curve.
    The scalar is clamped, as done in the public key generation case,
    by setting to zero the bits in position [0, 1, 2, 255] and setting
    to one the bit in position 254.

    :param n: a :py:data:`.crypto_scalarmult_ed25519_SCALARBYTES` long bytes
              sequence representing a scalar
    :type n: bytes
    :param p: a :py:data:`.crypto_scalarmult_ed25519_BYTES` long bytes sequence
              representing a point on the edwards25519 curve
    :type p: bytes
    :return: a point on the edwards25519 curve, represented as a
             :py:data:`.crypto_scalarmult_ed25519_BYTES` long bytes sequence
    :rtype: bytes
    :raises nacl.exceptions.UnavailableError: If called when using a
        minimal build of libsodium.
    r   r   r    r!   r)   r   r   r   N)r   r"   r   r#   r$   r%   r&   r!   r'   r(   r)   r   r   r   crypto_scalarmult_ed25519r   r   r   s       r   r.   r.      s4   ( %($    1e 	<FF;;0773	
 	
     1eJQ+J!J077-	
 	
     	!#BCCA		&q!Q	/	/B
27.8HIIII:a899!!!<<r   c                    t          t          dt          j                   t          t	          | t
                    ot          |           t          k    d                    d          t          j	                   t          t	          |t
                    ot          |          t          k    d                    d          t          j	                   t          j        dt                    }t          j        || |          }t          |dk    dt          j                   t          j        |t                    d	d	         S )
a  
    Computes and returns the scalar product of an integer ``n``
    and the given group element on the edwards25519 curve. The integer
    ``n`` is not clamped.

    :param n: a :py:data:`.crypto_scalarmult_ed25519_SCALARBYTES` long bytes
              sequence representing a scalar
    :type n: bytes
    :param p: a :py:data:`.crypto_scalarmult_ed25519_BYTES` long bytes sequence
              representing a point on the edwards25519 curve
    :type p: bytes
    :return: a point on the edwards25519 curve, represented as a
             :py:data:`.crypto_scalarmult_ed25519_BYTES` long bytes sequence
    :rtype: bytes
    :raises nacl.exceptions.UnavailableError: If called when using a
        minimal build of libsodium.
    r   r   r    r!   r)   r   r   r   N)r   r"   r   r#   r$   r%   r&   r!   r'   r(   r)   r   r   r   !crypto_scalarmult_ed25519_noclampr   r   r   s       r   r0   r0      s4   $ %($    1e 	<FF;;0773	
 	
     1eJQ+J!J077-	
 	
     	!#BCCA		.q!Q	7	7B
27.8HIIII:a899!!!<<r   N)naclr   r   nacl._sodiumr   r   nacl.exceptionsr   bool$PYNACL_HAS_CRYPTO_SCALARMULT_ED25519r"   crypto_scalarmult_bytesr   int__annotations__crypto_scalarmult_scalarbytesr   r)   r!   crypto_scalarmult_ed25519_bytes%crypto_scalarmult_ed25519_scalarbytesr%   r   r   r*   r,   r.   r0    r   r   <module>r=      s    # " " " " " " ! ! ! ! ! ! ! ! " " " " " " !%S%M N N :s:<<  < < <%FS%F%H%H s H H H"# () %  &Ic&I&K&K#1133 *
;e ; ; ; ; ; ; ;5 ;U ; ; ; ;""=e "= "= "= "= "=J"=e "= "= "= "= "=J0= 0=5 0=U 0= 0= 0= 0=f.= .=5 .=U .= .= .= .= .= .=r   