3 L](@sdZddlmZmZmZddlZddlZejj Z ejj Z ejj ZejjZejjZejjZejjZejjZejjZejjZejjZejjZ ejj!Z"ejj#Z$ejj%Z&ej'j(fddZ)ej'j(fddZ*e dddej'j(fd d Z+e+Z,dej'j(fd d Z-e-Z.dej'j(fd dZ/dS)z The :mod:`nacl.hash` module exposes one-shot interfaces for libsodium selected hash primitives and the constants needed for their usage. )absolute_importdivisionprint_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 )encodenaclbindingsZcrypto_hash_sha256)messageencoderr -/tmp/pip-install-wfra5znf/pynacl/nacl/hash.pysha256<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_sizekeysaltperson) _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 siphashx24s 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_siphashx24rencodingZ HexEncoderr r rZ generichashrZ shorthashrr r r r s6  !