a )gX @sddlmZmZmZeZddlZddlmZzddlm Z Wne yRdZ Yn0ddl m Z ddlmZefddZefd d ZeZeZd d Zd dZ dS))absolute_importdivisionprint_functionN)sha1)md5) AnsibleError)to_bytescCs$|}t|dd}|||S)z* Return a secure hash hex digest of data. surrogate_or_stricterrors)rupdate hexdigest)data hash_funcdigestr9/usr/lib/python3.9/site-packages/ansible/utils/hashing.py secure_hash_s$s  rc Cstjt|ddr(tjt|ddr,dS|}d}zBtt|ddd}||}|rn||||}qT|Wn4t y}zt d||fWYd}~n d}~00| S)z\ Return a secure hash hex digest of local file, None if file is not present or a directory. r r strictNirbz0error while accessing the file %s, error was: %s) ospathexistsrisdiropenreadr closeIOErrorrr )filenamerr blocksizeZinfileblockerrr secure_hash-s(    &r"cCsts tdt|tSNz1MD5 not available. Possibly running in FIPS mode)_md5 ValueErrorr)rrrrmd5sPsr&cCsts tdt|tSr#)r$r%r")rrrrrVsr)Z __future__rrrtypeZ __metaclass__rZhashlibrrr$ ImportErrorZansible.errorsrZansible.module_utils._textrrr"ZchecksumZ checksum_sr&rrrrs