3 /f"$@sfdZd%ZeeZeeZed&ZyddlmZWne k rLddZYnXiZ edddZ ddZ esxd'ddZ d(dd Zy dd!lZeZe ZejejZWne k re Ze ZYnXdd"lmZydd#lmZWne k rYnXxTeD]LZyeeee<Wn2ek rBes>dd!lZejd$eYnXqW[[[[[ ejs`[ [d!S))a3hashlib module - A common interface to many hash functions. new(name, data=b'', **kwargs) - returns a new hash object implementing the given hash function; initializing the hash using the given binary data. Named constructor functions are also available, these are faster than using new(name): md5(), sha1(), sha224(), sha256(), sha384(), sha512(), blake2b(), blake2s(), sha3_224, sha3_256, sha3_384, sha3_512, shake_128, and shake_256. More algorithms may be available on your platform but the above are guaranteed to exist. See the algorithms_guaranteed and algorithms_available attributes to find out what algorithm names can be passed to new(). NOTE: If you want the adler32 or crc32 hash functions they are available in the zlib module. Choose your hash function wisely. Some have known collision weaknesses. sha384 and sha512 will be slow on 32 bit platforms. Hash objects have these methods: - update(data): Update the hash object with the bytes in data. Repeated calls are equivalent to a single call with the concatenation of all the arguments. - digest(): Return the digest of the bytes passed to the update() method so far as a bytes object. - hexdigest(): Like digest() except the digest is returned as a string of double length, containing only hexadecimal digits. - copy(): Return a copy (clone) of the hash object. This can be used to efficiently compute the digests of datas that share a common initial substring. For example, to obtain the digest of the byte string 'Nobody inspects the spammish repetition': >>> import hashlib >>> m = hashlib.md5() >>> m.update(b"Nobody inspects") >>> m.update(b" the spammish repetition") >>> m.digest() b'\xbbd\x9c\x83\xdd\x1e\xa5\xc9\xd9\xde\xc9\xa1\x8d\xf0\xff\xe9' More condensed: >>> hashlib.sha224(b"Nobody inspects the spammish repetition").hexdigest() 'a4337bc45a8fc544c03f52dc550cd6e1e87021bc896588bd79e901e2' md5sha1sha224sha256sha384sha512blake2bblake2ssha3_224sha3_256sha3_384sha3_512 shake_128 shake_256newalgorithms_guaranteedalgorithms_available pbkdf2_hmac) get_fips_modecCsdS)Nrrrr/usr/lib64/python3.6/hashlib.py_hashlib_get_fips_modeIsr)rc Cst}|j|}|dk r|Sy2|s|dkrHddl}|j|d<|d<n|dkrlddl}|j|d<|d<nj|dkrddl}|j|d<|d <|j|d<|d<n4|dkrddl }|j |d <|d <|j |d <|d <|dkrddl }|j |d<|j|d<nN|dkrLddl} | j|d<| j|d<| j|d<| j|d<| j|d<| j|d<Wntk rdYnX|j|}|dk r~|Std|dS)NSHA1rrMD5rSHA256rSHA224rSHA512rSHA384rrrr r r r r rzunsupported hash type )rr)rr)rrrr)rrrr)rr>r r r r rr )__builtin_constructor_cacheget_sha1r_md5r_sha256rr_sha512rr_blake2rr_sha3r r r r r r ImportError ValueError) namercache constructorr r!r"r#r$r%rrr__get_builtin_constructorOsN           r+c CsR|d krt|Sy ttd |}tjs.||Sttfk rLt|SXdS) Nrrrr r r r r Zopenssl_>r r r r rrrr )r+getattr_hashlibrAttributeErrorr')r(frrr__get_openssl_constructor{sr0cKst||f|S)N)r+)r(datakwargsrrr__py_newsr4c Kstjr(|}dddddddj||}n|d kr@t||f|Sy:|jd d }tj|||d }tjrx||krx|j||Stk rtjrt||f|SXdS)Nzsha3-224zsha3-256zsha3-384zsha3-512Zshake128Zshake256)r r r r r rrrusedforsecurityT)r5>rr)r-rrr+poprZ _set_namer')r(r2r3Z orig_namer5Zretvalrrr __hash_news,    r7N)r)scryptzcode for hash %s was not found.)rrrrrrrrr r r r r r)rrrr)r1)r1)__doc__Z__always_supportedsetrr__all__r-rrr&rr+r0r4r7rZ __get_hashunionZopenssl_md_meth_namesrr8Z __func_nameglobalsr'ZloggingZ exceptionrrrr6sX,  '