U
    /e	                     @   s   d dl Z d dlZg Zzd dlZW n ek
r4   Y nX ejdkrRdd Zee zd dlZW n ek
rr   Y nX dd Z	ee	 zd dl
Z
W n ek
r   Y nX dd Zee d	d
 Zee dddZdddZdS )    Nz0.2.2c                 C   s   t | }|ddS )zJ
            Produce a 16-bytes hash of *buf* using CityHash.
               little)cityhashZCityHash128to_bytes)bufh r   0/tmp/pip-unpacked-wheel-dbjnr7gq/dask/hashing.py_hash_cityhash   s    
r
   c                 C   s   t |  S )z?
        Produce a 8-bytes hash of *buf* using xxHash.
        )xxhashZxxh64digestr   r   r   r	   _hash_xxhash&   s    r   c                 C   s
   t | S )zD
        Produce a 16-bytes hash of *buf* using MurmurHash.
        )mmh3Z
hash_bytesr   r   r   r	   _hash_murmurhash4   s    r   c                 C   s   t |  S )z6
    Produce a 20-bytes hash of *buf* using SHA1.
    )hashlibsha1r   r   r   r   r	   
_hash_sha1=   s    r   c              
   C   st   |dk	r,z
|| W S  t tfk
r*   Y nX tD ],}z|| W   S  t tfk
rZ   Y q0X q0t dt|  dS )z
    Hash a bytes-like (buffer-compatible) object.  This function returns
    a good quality hash but is not cryptographically secure.  The fastest
    available algorithm is selected.  A fixed-length bytes object is returned.
    Nzunsupported type for hashing: )	TypeErrorOverflowErrorhasherstype)r   hasherr   r   r	   hash_bufferG   s    
r   c                 C   s   t | |}t|}| S )zJ
    Same as hash_buffer, but returns its result in hex-encoded form.
    )r   binasciib2a_hexdecode)r   r   r   sr   r   r	   hash_buffer_hex\   s    

r   )N)N)r   r   r   r   ImportError__version__r
   appendr   r   r   r   r   r   r   r   r   r   r	   <module>   s2   	





