3 œäL](ã@sdZddlmZmZmZddlZddlZejj Z ejj Z ejj ZejjZejjZejjZejjZejjZejjZejjZejjZejjZ ejj!Z"ejj#Z$ejj%Z&ej'j(fdd„Z)ej'j(fdd„Z*e dddej'j(fd d „Z+e+Z,dej'j(fd d „Z-e-Z.dej'j(fd d„Z/dS)zŠ The :mod:`nacl.hash` module exposes one-shot interfaces for libsodium selected hash primitives and the constants needed for their usage. é)Úabsolute_importÚdivisionÚprint_functionNcCs|jtjj|ƒƒ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ÚbindingsZcrypto_hash_sha256)ÚmessageÚencoder©r ú-/tmp/pip-install-wfra5znf/pynacl/nacl/hash.pyÚsha256<s r cCs|jtjj|ƒƒ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 )rrrZcrypto_hash_sha512)rr r r r Úsha512Is r ócCst|||||d�}|j|ƒ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 )Ú digest_sizeÚkeyÚsaltÚperson)Ú _b2b_hashr)Údatarrrrr Údigestr r r Úblake2bVs rcCst||ƒ}|j|ƒ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)rrr rr r r Ú siphash24|s rcCst||ƒ}|j|ƒS)aÜ 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`) .. versionadded:: 1.2 )Ú _sip_hashxr)rrr rr r r Ú siphashx24�s r)0Ú__doc__Ú __future__rrrZ nacl.bindingsrZ nacl.encodingrZcrypto_generichash_BYTESZ BLAKE2B_BYTESZcrypto_generichash_BYTES_MINZBLAKE2B_BYTES_MINZcrypto_generichash_BYTES_MAXZBLAKE2B_BYTES_MAXZcrypto_generichash_KEYBYTESZBLAKE2B_KEYBYTESZcrypto_generichash_KEYBYTES_MINZBLAKE2B_KEYBYTES_MINZcrypto_generichash_KEYBYTES_MAXZBLAKE2B_KEYBYTES_MAXZcrypto_generichash_SALTBYTESZBLAKE2B_SALTBYTESZ crypto_generichash_PERSONALBYTESZBLAKE2B_PERSONALBYTESZ crypto_shorthash_siphash24_BYTESZ SIPHASH_BYTESZ#crypto_shorthash_siphash24_KEYBYTESZSIPHASH_KEYBYTESZ!crypto_shorthash_siphashx24_BYTESZSIPHASHX_BYTESZ$crypto_shorthash_siphashx24_KEYBYTESZSIPHASHX_KEYBYTESZ(crypto_generichash_blake2b_salt_personalrZcrypto_shorthash_siphash24rZcrypto_shorthash_siphashx24rÚencodingZ HexEncoderr r rZ generichashrZ shorthashrr r r r Ús6  !