U
    ÎZjø  ã                	   @   sN  d Z ddlZddlZejjZejjZejj	Z
ejjZejjZejjZejjZejjZejjZejjZejjZejjZejjZejjZ ejj!Z"ejj#Z$ej%j&fe'ej%j(e'dœdd„Z)ej%j&fe'ej%j(e'dœdd„Z*edddej%j&fe'e+e'e'e'ej%j(e'd	œd
d„Z,e,Z-dej%j&fe'e'ej%j(e'dœdd„Z.e.Z/dej%j&fe'e'ej%j(e'dœdd„Z0dS )zŠ
The :mod:`nacl.hash` module exposes one-shot interfaces
for libsodium selected hash primitives and the constants needed
for their usage.
é    N)ÚmessageÚencoderÚreturnc                 C   s   |  tj | ¡¡S )zç
    Hashes ``message`` with SHA256.

    :param message: The message to hash.
    :type message: bytes
    :param encoder: A class that is able to encode the hashed message.
    :returns: The hashed message.
    :rtype: bytes
    )ÚencodeÚnaclÚbindingsZcrypto_hash_sha256©r   r   © r	   úL/var/www/html/TRUCKING_PROJECT/venv/lib/python3.8/site-packages/nacl/hash.pyÚsha256>   s    r   c                 C   s   |  tj | ¡¡S )zç
    Hashes ``message`` with SHA512.

    :param message: The message to hash.
    :type message: bytes
    :param encoder: A class that is able to encode the hashed message.
    :returns: The hashed message.
    :rtype: bytes
    )r   r   r   Zcrypto_hash_sha512r   r	   r	   r
   Úsha512M   s    r   ó    )ÚdataÚdigest_sizeÚkeyÚsaltÚpersonr   r   c                 C   s   t | ||||d�}| |¡S )aø  
    Hashes ``data`` with blake2b.

    :param data: the digest input byte sequence
    :type data: bytes
    :param digest_size: the requested digest size; must be at most
                        :const:`BLAKE2B_BYTES_MAX`;
                        the default digest size is
                        :const:`BLAKE2B_BYTES`
    :type digest_size: int
    :param key: the key to be set for keyed MAC/PRF usage; if set, the key
                must be at most :data:`~nacl.hash.BLAKE2B_KEYBYTES_MAX` long
    :type key: bytes
    :param salt: an initialization salt at most
                 :const:`BLAKE2B_SALTBYTES` long;
                 it will be zero-padded if needed
    :type salt: bytes
    :param person: a personalization string at most
                   :const:`BLAKE2B_PERSONALBYTES` long;
                   it will be zero-padded if needed
    :type person: bytes
    :param encoder: the encoder to use on returned digest
    :type encoder: class
    :returns: The hashed message.
    :rtype: bytes
    )r   r   r   r   )Ú	_b2b_hashr   )r   r   r   r   r   r   Údigestr	   r	   r
   Úblake2b\   s    #    ÿr   )r   r   r   r   c                 C   s   t | |ƒ}| |¡S )a¾  
    Computes a keyed MAC of ``message`` using the short-input-optimized
    siphash-2-4 construction.

    :param message: The message to hash.
    :type message: bytes
    :param key: the message authentication key for the siphash MAC construct
    :type key: bytes(:const:`SIPHASH_KEYBYTES`)
    :param encoder: A class that is able to encode the hashed message.
    :returns: The hashed message.
    :rtype: bytes(:const:`SIPHASH_BYTES`)
    )Ú	_sip_hashr   ©r   r   r   r   r	   r	   r
   Ú	siphash24ˆ   s    
r   c                 C   s   t | |ƒ}| |¡S )aE  
    Computes a keyed MAC of ``message`` using the 128 bit variant of the
    siphash-2-4 construction.

    :param message: The message to hash.
    :type message: bytes
    :param key: the message authentication key for the siphash MAC construct
    :type key: bytes(:const:`SIPHASHX_KEYBYTES`)
    :param encoder: A class that is able to encode the hashed message.
    :returns: The hashed message.
    :rtype: bytes(:const:`SIPHASHX_BYTES`)
    :raises nacl.exceptions.UnavailableError: If called when using a
        minimal build of libsodium.

    .. versionadded:: 1.2
    )Ú
_sip_hashxr   r   r	   r	   r
   Ú
siphashx24    s    
r   )1Ú__doc__Znacl.bindingsr   Znacl.encodingr   Zcrypto_generichash_BYTESZBLAKE2B_BYTESZcrypto_generichash_BYTES_MINZBLAKE2B_BYTES_MINZcrypto_generichash_BYTES_MAXZBLAKE2B_BYTES_MAXZcrypto_generichash_KEYBYTESZBLAKE2B_KEYBYTESZcrypto_generichash_KEYBYTES_MINZBLAKE2B_KEYBYTES_MINZcrypto_generichash_KEYBYTES_MAXZBLAKE2B_KEYBYTES_MAXZcrypto_generichash_SALTBYTESZBLAKE2B_SALTBYTESZ crypto_generichash_PERSONALBYTESZBLAKE2B_PERSONALBYTESZ crypto_shorthash_siphash24_BYTESZSIPHASH_BYTESZ#crypto_shorthash_siphash24_KEYBYTESZSIPHASH_KEYBYTESZhas_crypto_shorthash_siphashx24ZSIPHASHX_AVAILABLEZ!crypto_shorthash_siphashx24_BYTESZSIPHASHX_BYTESZ$crypto_shorthash_siphashx24_KEYBYTESZSIPHASHX_KEYBYTESZ(crypto_generichash_blake2b_salt_personalr   Zcrypto_shorthash_siphash24r   Zcrypto_shorthash_siphashx24r   ÚencodingZ
HexEncoderÚbytesZEncoderr   r   Úintr   Zgenerichashr   Z	shorthashr   r	   r	   r	   r
   Ú<module>   s|   ÿ þÿ þúù)ýüýü