;iy dZddlmZmZmZddedededefdZd gZ e d krYe d dd l Z e d D]1Ze j\ZZernedzdkrere dez2e dd Sd S)zFunctions 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 )commonpkcs1 transformSHA-1seedlengthhasherreturnc " tjj}nr#t$re}t ddttj|d}~wwxYw|d|zkr$td|dfd ttj ||d zD}|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_listNlzmDesired length should be at most 2**32 times the hasher's output length ({hash_length} for {hasher} function)) hash_lengthr c3rK|]1}tjtj|dzV2dS)) fill_size) method_nameN)r compute_hashr int2bytes).0counterr rs @C:\PYTHON\MyICR_Workspace\venv\Lib\site-packages\rsa/pkcs1_v2.py zmgf1..Hsf   9&w!<<< <   r) r HASH_METHODS digest_sizeKeyError ValueErrorformatjoinsortedkeys OverflowErrorrangerceil_div)rrr r exoutputs` ` rmgf1r'sE,(022>  K R R))F5+=+B+B+D+D$E$EFF S      ;&'' ;;A6'r8s* 55u5c535U5555r   z E 3444NNNt&&+GO--5   E 3;!    E*u$ % % % E/r