U q` @sddlmZmZmZddlmZddlmZm Z ddlm Z e e j Z e Ze ZdZdZe rre Ze ZddZddZdS) )absolute_importdivisionprint_functionN)ffilib)ensurecCsbt|tkrtdttdt}t ||t||}t |dktj dt |tddS)zCompute 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 {0} bytesunsigned char[]rZraisingN) lenKEYBYTESexc ValueErrorformatrnewBYTESrcrypto_shorthash_siphash24r RuntimeErrorbufferdatakeydigestrcrE/tmp/pip-target-nv4zd3e_/lib/python/nacl/bindings/crypto_shorthash.pyr$s  rcCsrttdtjdt|tkr,tdtt dt }t ||t||}t|dktj dt|t ddS)aCCompute 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. zNot available in minimal buildr rr rN)rhas_crypto_shorthash_siphashx24r ZUnavailableErrorr XKEYBYTESrrrrXBYTESrcrypto_shorthash_siphashx24rrrrrrr7s   r) __future__rrrZnacl.exceptions exceptionsr Z nacl._sodiumrrrboolZ&PYNACL_HAS_CRYPTO_SHORTHASH_SIPHASHX24rZ crypto_shorthash_siphash24_bytesrZ#crypto_shorthash_siphash24_keybytesr rrZ!crypto_shorthash_siphashx24_bytesZ$crypto_shorthash_siphashx24_keybytesrrrrrrs