a aD@sddlZddlZddlmZddlmZGdddejdZGdddejdZGd d d ejdZ Gd d d eZ Gd ddeZ GdddeZ GdddeZ GdddeZGdddeZGdddeZGdddeZGdddeZGdddeZGdd d eZGd!d"d"eZGd#d$d$ee ZGd%d&d&ee ZGd'd(d(eZGd)d*d*eZGd+d,d,eZGd-d.d.eZdS)/N)utils)AlreadyFinalizedc@sNeZdZejedddZejedddZeje j edddZ dS) HashAlgorithmreturncCsdS)zH A string naming this algorithm (e.g. "sha256", "md5"). NselfrrK/usr/lib64/python3.9/site-packages/cryptography/hazmat/primitives/hashes.pynameszHashAlgorithm.namecCsdS)z< The size of the resulting digest in bytes. Nrrrrr digest_sizeszHashAlgorithm.digest_sizecCsdS)z The internal block size of the hash function, or None if the hash function does not use blocks internally (e.g. SHA3). Nrrrrr block_sizeszHashAlgorithm.block_sizeN) __name__ __module__ __qualname__abcabstractpropertystrr intr typingOptionalr rrrr rs r) metaclassc@s^eZdZejedddZejeddddZ ejeddd Z ejddd d Z dS) HashContextrcCsdS)zD A HashAlgorithm that will be used by this context. Nrrrrr algorithm$szHashContext.algorithmNdatarcCsdS)z@ Processes the provided bytes through the hash. Nrr rrrr update*szHashContext.updatecCsdS)zR Finalizes the hash context and returns the hash digest as bytes. Nrrrrr finalize0szHashContext.finalizecCsdS)zM Return a HashContext that is a copy of the current context. Nrrrrr copy6szHashContext.copy) rrrrrrrabstractmethodbytesrrrrrrr r#src@seZdZdZdS)ExtendableOutputFunctionz7 An interface for extendable output functions. N)rrr__doc__rrrr r"=sr"c@sfeZdZdeejejddddZeedddZ e dd d d Z ddd d Z e dddZ dS)HashNr)rbackendctxcCsFt|tstd||_|dursr>c@seZdZdZdZdZdS)SHA3_256zsha3-256r8Nr3rrrr r?sr?c@seZdZdZdZdZdS)SHA3_384zsha3-384r<Nr3rrrr r@sr@c@seZdZdZdZdZdS)SHA3_512zsha3-512r2Nr3rrrr rAsrAc@s4eZdZdZdZedddZeedddZdS) SHAKE128Zshake128Nr cCs,t|tstd|dkr"td||_dSNzdigest_size must be an integerz&digest_size must be a positive integerr'rr( ValueError _digest_sizer r rrr r+s  zSHAKE128.__init__rcCs|jSr,rHrrrr r szSHAKE128.digest_size rrrr r rr+r/r rrrr rBs  rBc@s4eZdZdZdZedddZeedddZdS) SHAKE256Zshake256NrCcCs,t|tstd|dkr"td||_dSrDrFrIrrr r+s  zSHAKE256.__init__rcCs|jSr,rJrrrr r szSHAKE256.digest_sizerKrrrr rLs  rLc@seZdZdZdZdZdS)MD5Zmd5r2Nr3rrrr rMsrMc@s<eZdZdZdZdZdZedddZe edd d Z d S) BLAKE2bZblake2br2rEr6rCcCs|dkrtd||_dS)Nr2zDigest size must be 64rGrHrIrrr r+szBLAKE2b.__init__rcCs|jSr,rJrrrr r szBLAKE2b.digest_sizeN) rrrr _max_digest_size_min_digest_sizer rr+r/r rrrr rOsrOc@s<eZdZdZdZdZdZedddZe edd d Z d S) BLAKE2sZblake2sr2r8rErCcCs|dkrtd||_dS)Nr8zDigest size must be 32rPrIrrr r+szBLAKE2s.__init__rcCs|jSr,rJrrrr r szBLAKE2s.digest_sizeN) rrrr r rQrRrr+r/r rrrr rSsrSc@seZdZdZdZdZdS)SM3Zsm3r8r2Nr3rrrr rTsrT)rrZ cryptographyrZcryptography.exceptionsrABCMetarrr"r$r0r4r7r9r:r;r=r>r?r@rArBrLrMrOrSrTrrrr s0  +