HEX
Server: Apache/2.4.58 (Ubuntu)
System: Linux ip-172-31-18-78 6.17.0-1017-aws #17~24.04.1-Ubuntu SMP Tue May 26 21:09:53 UTC 2026 aarch64
User: ubuntu (1000)
PHP: 8.2.31
Disabled: NONE
Upload Files
File: //lib/python3/dist-packages/rsa/__pycache__/pkcs1_v2.cpython-312.pyc
�

%
�a�
�	���dZddlmZmZmZddedededefd�ZdgZ	e
d	k(rQed
�ddlZe
d�D]1Zej�\ZZerned
zdk(s�$es�'edez��3ed�yy)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�seed�length�hasher�returnc�����	tj��j}|d|zkDrtdj|�����dj
��fd	�ttj||�d
z�D��}|d|S#t$rU}t	djdj
ttjj������|�d}~wwxYw)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_listNlzmDesired length should be at most 2**32 times the hasher's output length ({hash_length} for {hasher} function))�hash_lengthr�c3�|�K�|]3}tj�tj|d��z������5y�w)�)�	fill_size)�method_nameN)r�compute_hashr�	int2bytes)�.0�counterrrs  ���./usr/lib/python3/dist-packages/rsa/pkcs1_v2.py�	<genexpr>zmgf1.<locals>.<genexpr>HsC������

�		����9�&�&�w�!�<�<��	
�	
��s�9<�)
r�HASH_METHODS�digest_size�KeyError�
ValueError�format�join�sorted�keys�
OverflowError�ranger�ceil_div)rrrr�ex�outputs` `   r�mgf1r&s����,��(�(��0�2�>�>����;�&�'��
;�;A�6�'��<B�<�
�	
��X�X��
�V�_�_�V�[�A�A�E�F���F��'�6�?���;���K�R�R��)�)�F�5�+=�+=�+B�+B�+D�$E�F�
S�
�
��		���s�!B	�		C'�AC"�"C'r&�__main__z'Running doctests 1000x or until failureNi��dz%i timesz
Doctests done)zSHA-1)�__doc__�rsarrr�bytes�int�strr&�__all__�__name__�print�doctestr"�count�testmod�failures�tests�r
r�<module>r7s������5�u�5�c�5�3�5�U�5�r����z��	�
3�4���t��&��+�G�O�O�-���5����3�;�!����*�u�$�%�
&�
�/��r