관리-도구
편집 파일: hashing.cpython-39.pyc
a �)gX � @ s� d dl mZmZmZ eZd dlZd dlmZ zd dlm Z W n eyR dZ Y n0 d dlm Z d dlmZ efdd�Zefd d �ZeZeZdd� Zd d� Z dS )� )�absolute_import�division�print_functionN)�sha1)�md5)�AnsibleError)�to_bytesc C s$ |� }t | dd�} |�| � |�� S )z* Return a secure hash hex digest of data. �surrogate_or_strict��errors)r �update� hexdigest)�data� hash_func�digest� r �9/usr/lib/python3.9/site-packages/ansible/utils/hashing.py� secure_hash_s$ s r c C s� t j�t| dd��r(t j�t| dd��r,dS |� }d}zBtt| dd�d�}|�|�}|rn|�|� |�|�}qT|�� W n4 t y� } zt d| |f ��W Y d}~n d}~0 0 |�� S )z\ Return a secure hash hex digest of local file, None if file is not present or a directory. r r �strictNi �rbz0error while accessing the file %s, error was: %s)�os�path�existsr �isdir�open�readr �close�IOErrorr r )�filenamer r � blocksizeZinfile�block�er r r �secure_hash- s ( &r"