§
    jŠtjy  ã            	       óü   — d Z ddlmZmZmZ ddedededefd„Zd	gZ	e
d
k    rY ed¦  «         ddlZ ed¦  «        D ]1Z ej        ¦   «         \  ZZer nedz  dk    rer edez  ¦  «         Œ2 ed¦  «         dS dS )z¿Functions for PKCS#1 version 2 encryption and signing

This module implements certain functionality from PKCS#1 version 2. Main
documentation is RFC 2437: https://tools.ietf.org/html/rfc2437
é    )ÚcommonÚpkcs1Ú	transformúSHA-1ÚseedÚlengthÚhasherÚreturnc                 ó"  ‡ ‡— 	 t          j        ‰         ¦   «         j        }nr# t          $ re}t	          d                     d                     t          t           j                             ¦   «         ¦  «        ¦  «        ¬¦  «        ¦  «        |‚d}~ww xY w|d|z  k    r$t          d                     |‰¬¦  «        ¦  «        ‚d                     ˆˆ fd	„t          t          j        ||¦  «        d
z   ¦  «        D ¦   «         ¦  «        }|d|…         S )aˆ  
    MGF1 is a Mask Generation Function based on a hash function.

    A mask generation function takes an octet string of variable length and a
    desired output length as input, and outputs an octet string of the desired
    length. The plaintext-awareness of RSAES-OAEP relies on the random nature of
    the output of the mask generation function, which in turn relies on the
    random nature of the underlying hash.

    :param bytes seed: seed from which mask is generated, an octet string
    :param int length: intended length in octets of the mask, at most 2^32(hLen)
    :param str hasher: hash function (hLen denotes the length in octets of the hash
        function output)

    :return: mask, an octet string of length `length`
    :rtype: bytes

    :raise OverflowError: when `length` is too large for the specified `hasher`
    :raise ValueError: when specified `hasher` is invalid
    z=Invalid `hasher` specified. Please select one of: {hash_list}z, )Ú	hash_listNl        zmDesired length should be at most 2**32 times the hasher's output length ({hash_length} for {hasher} function))Úhash_lengthr	   ó    c              3   ór   •K  — | ]1}t          j        ‰t          j        |d ¬¦  «        z   ‰¬¦  «        V — Œ2dS )é   )Ú	fill_size)Úmethod_nameN)r   Úcompute_hashr   Ú	int2bytes)Ú.0Úcounterr	   r   s     €€úJ/var/www/html/CA-Chatbot/venv/lib/python3.11/site-packages/rsa/pkcs1_v2.pyú	<genexpr>zmgf1.<locals>.<genexpr>H   sf   øè è € ð ð ð
 õ	 	ÔØ•9Ô& w¸!Ð<Ñ<Ô<Ñ<Øð	
ñ 	
ô 	
ðð ð ð ð ð r   é   )r   ÚHASH_METHODSÚdigest_sizeÚKeyErrorÚ
ValueErrorÚformatÚjoinÚsortedÚkeysÚOverflowErrorÚranger   Úceil_div)r   r   r	   r   ÚexÚoutputs   ` `   r   Úmgf1r'      sE  øø€ ð,ÝÔ(¨Ô0Ñ2Ô2Ô>ˆˆøÝð ð ð ÝØK×RÒRØŸ)š)¥F­5Ô+=×+BÒ+BÑ+DÔ+DÑ$EÔ$EÑFÔFð Sñ ô ñ
ô 
ð ð		øøøøðøøøð �˜;Ñ&Ò'Ð'Ýð;ß;Aº6Ø'Øð <Bñ <ô <ñ
ô 
ð 	
ð �XŠXð ð ð ð ð õ
 �Vœ_¨V°[ÑAÔAÀAÑEÑFÔFðñ ô ñ ô €Fð �'�6�'Œ?Ðs   „# £
B­A BÂBr'   Ú__main__z'Running doctests 1000x or until failureNiè  éd   z%i timeszDoctests done)r   )Ú__doc__Úrsar   r   r   ÚbytesÚintÚstrr'   Ú__all__Ú__name__ÚprintÚdoctestr#   ÚcountÚtestmodÚfailuresÚtests© r   r   ú<module>r8      s*  ððð ðð ð ð ð ð ð ð ð ð ð5ð 5ˆuð 5˜cð 5¨3ð 5¸Uð 5ð 5ð 5ð 5ðr ð€ð ˆzÒÐØ	€EÐ
3Ñ4Ô4Ð4Ø€N€N€Nà��t‘”ð &ð &ˆØ+˜GœOÑ-Ô-Ñˆ�5Øð 	ØˆEà�3‰;˜!ÒÐ ÐØˆE�*˜uÑ$Ñ%Ô%Ð%øà	€Eˆ/ÑÔÐÐÐð Ðr   