U
    ֫[                     @   s`   d dl mZmZmZ d dlmZ d dlmZm	Z	 d dl
mZ e	 Ze	 Zdd Zdd Zd	S )
    )absolute_importdivisionprint_function)
exceptions)ffilib)ensurec                 C   s@   t dt}t|| }t|dkdtjd t |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ZraisingN)
r   newcrypto_scalarmult_BYTESr   crypto_scalarmult_baser   excRuntimeErrorbuffercrypto_scalarmult_SCALARBYTES)nqrc r   A/usr/lib/python3/dist-packages/nacl/bindings/crypto_scalarmult.pyr      s    r   c                 C   sB   t dt}t|| |}t|dkdtjd t |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   pr   r   r   r   r   r   ,   s    	r   N)Z
__future__r   r   r   Znaclr   r   Znacl._sodiumr   r   Znacl.exceptionsr   Zcrypto_scalarmult_bytesr   Zcrypto_scalarmult_scalarbytesr   r   r   r   r   r   r   <module>   s   