o
    ç÷¡g+
  ã                   @   s    U d dl mZ d dlmZmZ d dl mZ eejƒZ	e 
¡ Zeed< e ¡ Zeed< d Zd Ze	r8e ¡ Ze ¡ Zdededefd	d
„Zdededefdd„ZdS )é    N)ÚffiÚlib)ÚensureÚBYTESÚKEYBYTESÚdataÚkeyÚreturnc                 C   sb   t |ƒtkrt d t¡¡‚t dt¡}t 	|| t | ƒ|¡}t
|dktjd� t |t¡dd… S )zÙCompute a fast, cryptographic quality, keyed hash of the input data

    :param data:
    :type data: bytes
    :param key: len(key) must be equal to
                :py:data:`.KEYBYTES` (16)
    :type key: bytes
    ú#Key length must be exactly {} bytesúunsigned char[]r   ©ÚraisingN)Úlenr   ÚexcÚ
ValueErrorÚformatr   Únewr   r   Úcrypto_shorthash_siphash24r   ÚRuntimeErrorÚbuffer©r   r   ÚdigestÚrc© r   úI/usr/local/lib/python3.10/dist-packages/nacl/bindings/crypto_shorthash.pyr   $   s   	ÿr   c                 C   sr   t tdtjd� t|ƒtkrt d t¡¡‚t 	dt
¡}t || t| ƒ|¡}t |dktjd� t |t
¡dd… S )aC  Compute a fast, cryptographic quality, keyed hash of the input data

    :param data:
    :type data: bytes
    :param key: len(key) must be equal to
                :py:data:`.XKEYBYTES` (16)
    :type key: bytes
    :raises nacl.exceptions.UnavailableError: If called when using a
        minimal build of libsodium.
    zNot available in minimal buildr   r
   r   r   N)r   Úhas_crypto_shorthash_siphashx24r   ÚUnavailableErrorr   Ú	XKEYBYTESr   r   r   r   ÚXBYTESr   Úcrypto_shorthash_siphashx24r   r   r   r   r   r   r   8   s   ýÿr   )Únacl.exceptionsÚ
exceptionsr   Únacl._sodiumr   r   r   ÚboolÚ&PYNACL_HAS_CRYPTO_SHORTHASH_SIPHASHX24r   Ú crypto_shorthash_siphash24_bytesr   ÚintÚ__annotations__Ú#crypto_shorthash_siphash24_keybytesr   r   r   Ú!crypto_shorthash_siphashx24_bytesÚ$crypto_shorthash_siphashx24_keybytesÚbytesr   r   r   r   r   r   Ú<module>   s   ÿ