Server IP : 192.158.238.246 / Your IP : 3.133.87.185 Web Server : LiteSpeed System : Linux uniform.iwebfusion.net 4.18.0-553.27.1.lve.1.el8.x86_64 #1 SMP Wed Nov 20 15:58:00 UTC 2024 x86_64 User : jenniferflocom ( 1321) PHP Version : 8.1.32 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /usr/lib/python3.6/site-packages/asn1crypto/__pycache__/ |
Upload File : |
3 �3�X � @ s� d Z ddlmZmZmZmZ ddlZddlZddlm Z m Z yjddlmZm Z mZmZmZ ej� dkrle� �yddlmZ d d � ZW n eefk r� e� �Y nX W n eefk r� dd � ZY nX dd � ZdS )aN Function for calculating the modular inverse. Exports the following items: - inverse_mod() Source code is derived from http://webpages.charter.net/curryfans/peter/downloads.html, but has been heavily modified to fit into this projects lint settings. The original project license is listed below: Copyright (c) 2014 Peter Pearson Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. � )�unicode_literals�division�absolute_import�print_functionN� )�int_to_bytes�int_from_bytes)�buffer_from_bytes�bytes_from_buffer�FFIEngineError�LibraryNotFoundError�nullZPyPy)� libcryptoc C s t j� }tt| ��}tt|��}t|�}t j|t|�t� �}| dk rPt j|d� t|�}t j|t|�t� �}|dk r�t j|d� t j t� |||�} t j | �} ttj | d ��}t|�}t j| |� t||�} t| �}t j|� t j|� t j| � t j|� |S )z� Compute the modular inverse of a (mod p) :param a: An integer :param p: An integer :return: An integer r r � )r Z BN_CTX_newr �absr Z BN_bin2bn�lenr ZBN_set_negativeZBN_mod_inverseZBN_num_bits�int�mathZceilZ BN_bn2binr r ZBN_freeZBN_CTX_free)�a�pZctxZa_bytesZp_bytesZa_bufZa_bnZp_bufZp_bnZr_bnZ r_len_bitsZr_lenZr_bufZr_bytes�result� r �/usr/lib/python3.6/_int.py�inverse_mod: s. r c C s� | dk s|| kr| | } | | }}d\}}}}xF|dkrtt ||�|f \}}}||| ||| ||f\}}}}q0W |dks�t�|dkr�|S || S dS )z� Compute the modular inverse of a (mod p) :param a: An integer :param p: An integer :return: An integer r r N)r r r r )�divmod�AssertionError) r r �c�dZucZvcZudZvd�qr r r r k s (c C s xt | �|k rd| } qW | S )a Ensure a byte string representing a positive integer is a specific width (in bytes) :param bytes_: The integer byte string :param width: The desired width as an integer :return: A byte string of the width specified � )r )Zbytes_�widthr r r � fill_width� s r! )�__doc__Z __future__r r r r r �platform�utilr r Z_ffir r r r r Zpython_implementation�EnvironmentErrorZ_perf._big_num_ctypesr r �ImportErrorr! r r r r �<module> s +#