U
    ֫[                     @   sp   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e	 Zdd Zdd Zd	d
 ZdS )    )absolute_importdivisionprint_function)
exceptions)ffilib)ensurec                 C   sF   t dt}t|| t| }t|dkdtjd t 	|tdd S zb
    Hashes and returns the message ``message``.

    :param message: bytes
    :rtype: bytes
    zunsigned char[]r   zUnexpected library error)ZraisingN)
r   newcrypto_hash_BYTESr   crypto_hashlenr   excRuntimeErrorbuffermessageZdigestZrc r   ;/usr/lib/python3/dist-packages/nacl/bindings/crypto_hash.pyr      s    r   c                 C   sF   t dt}t|| t| }t|dkdtjd t 	|tdd S r	   )
r   r
   crypto_hash_sha256_BYTESr   crypto_hash_sha256r   r   r   r   r   r   r   r   r   r   +   s    r   c                 C   sF   t dt}t|| t| }t|dkdtjd t 	|tdd S r	   )
r   r
   crypto_hash_sha512_BYTESr   crypto_hash_sha512r   r   r   r   r   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_hash_sha512_bytesr   Zcrypto_hash_sha256_bytesr   r   r   r   r   r   r   r   r   <module>   s   