HEX
Server: Apache/2.4.52 (Ubuntu)
System: Linux spn-python 5.15.0-89-generic #99-Ubuntu SMP Mon Oct 30 20:42:41 UTC 2023 x86_64
User: arjun (1000)
PHP: 8.1.2-1ubuntu2.20
Disabled: NONE
Upload Files
File: //home/arjun/projects/env/lib/python3.10/site-packages/pathlib_mate/hashes.pyc
�
�´ac@s^ddlZdZdd�Zded�Zded�Zded	�Zded
�ZdS(i����Niisutf-8cCs)|�}|j|j|��|j�S(su
    Use default hash method to return hash value of a piece of string
    default setting use 'utf-8' encoding.
    (tupdatetencodet	hexdigest(ttextt	hash_methtencodingtm((spathlib_mate/hashes.pytget_text_fingerprints	ic	Cs:|dkrtd��n|dkr6td��n|dkrW||krW|}n|�}t|d���}|r�d}x�tr�||7}||kr�|||}|r�|j|�}|j|�nPq�|j|�}|j|�q�Wn3x0tr)|j|�}|sPn|j|�q�WWdQX|j�S(Nis chunk_size cannot smaller than 0is chunk_size cannot smaller than 1trb(t
ValueErrortopentTruetreadRR(	tabspathRtnbytest
chunk_sizeRtft
have_readstntdata((spathlib_mate/hashes.pytget_file_fingerprints4			
	cCst|tjd|d|�S(s�
    Return md5 hash value of a piece of a file

    Estimate processing time on:

    :param abspath: the absolute path to the file
    :param nbytes: only has first N bytes of the file. if 0 or None,
      hash all file

    CPU = i7-4600U 2.10GHz - 2.70GHz, RAM = 8.00 GB
    1 second can process 0.25GB data

    - 0.59G - 2.43 sec
    - 1.3G - 5.68 sec
    - 1.9G - 7.72 sec
    - 2.5G - 10.32 sec
    - 3.9G - 16.0 sec
    RR(Rthashlibtmd5(R
RR((spathlib_mate/hashes.pytmd5file3scCst|tjd|d|�S(s�
    Return sha256 hash value of a piece of a file

    Estimate processing time on:

    :param abspath: the absolute path to the file
    :param nbytes: only has first N bytes of the file. if 0 or None,
      hash all file
    RR(RRtsha256(R
RR((spathlib_mate/hashes.pyt
sha256fileIs
cCst|tjd|d|�S(s�
    Return sha512 hash value of a piece of a file

    Estimate processing time on:

    :param abspath: the absolute path to the file
    :param nbytes: only has first N bytes of the file. if 0 or None,
      hash all file
    RR(RRtsha512(R
RR((spathlib_mate/hashes.pyt
sha512fileVs
i@(RtDEFAULT_CHUNK_SIZERRRRR(((spathlib_mate/hashes.pyt<module>s
!