HEX
Server: LiteSpeed
System: Linux server.nevid-deploma.com 4.18.0-553.111.1.lve.el8.x86_64 #1 SMP Fri Mar 13 13:42:17 UTC 2026 x86_64
User: smilepac (1037)
PHP: 8.1.34
Disabled: NONE
Upload Files
File: //opt/cppython/lib/python3.8/site-packages/rsa/__pycache__/pkcs1_v2.cpython-38.pyc
U

JD�g�
�@s�dZddlmZmZmZdeeeed�dd�ZdgZ	e
dkr�ed�dd	lZe
d
�D]4Ze��\ZZerlq�eddkrTerTede�qTed
�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
s�ztj��j}WnDtk
rV}z&tdjd�ttj����d��|�W5d}~XYnX|d|krvt	dj|�d���d���fd	d
�t
t�||�d�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, )Z	hash_listNlzmDesired length should be at most 2**32 times the hasher's output length ({hash_length} for {hasher} function))�hash_lengthr�c3s*|]"}tj�tj|dd��d�VqdS)�)Z	fill_size)�method_nameN)rZcompute_hashrZ	int2bytes)�.0�counter�rr��9/opt/cppython/lib/python3.8/site-packages/rsa/pkcs1_v2.py�	<genexpr>Hs
��zmgf1.<locals>.<genexpr>�)
rZHASH_METHODS�digest_size�KeyError�
ValueError�format�join�sorted�keys�
OverflowError�rangerZceil_div)rrrr
�ex�outputrrr�mgf1s*������	r �__main__z'Running doctests 1000x or until failureNi��dz%i timesz
Doctests done)r)�__doc__�rsarrr�bytes�int�strr �__all__�__name__�print�doctestr�count�testmodZfailuresZtestsrrrr�<module>s9�