Submit
Path:
~
/
/
proc
/
thread-self
/
root
/
opt
/
alt
/
python37
/
lib
/
python3.7
/
site-packages
/
asn1crypto
/
__pycache__
/
File Content:
_int.cpython-37.pyc
B �3�X � @ s� d Z ddlmZmZmZmZ ddlZddlZddlm Z m Z yjddlmZm Z mZmZmZ e�� 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 �� }tt| ��}tt|��}t|�}t �|t|�t� �}| dk rPt �|d� t|�}t �|t|�t� �}|dk r�t �|d� t � t� |||�} t � | �} tt� | d ��}t|�}t �| |� t||�} t| �}t �|� t �|� t �| � t �|� |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 �@/opt/alt/python37/lib/python3.7/site-packages/asn1crypto/_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 r r r r N)�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 +#
Submit
FILE
FOLDER
Name
Size
Permission
Action
__init__.cpython-37.opt-1.pyc
382 bytes
0644
__init__.cpython-37.pyc
382 bytes
0644
_elliptic_curve.cpython-37.opt-1.pyc
7758 bytes
0644
_elliptic_curve.cpython-37.pyc
7832 bytes
0644
_errors.cpython-37.opt-1.pyc
1025 bytes
0644
_errors.cpython-37.pyc
1025 bytes
0644
_ffi.cpython-37.opt-1.pyc
1317 bytes
0644
_ffi.cpython-37.pyc
1317 bytes
0644
_inet.cpython-37.opt-1.pyc
3608 bytes
0644
_inet.cpython-37.pyc
3608 bytes
0644
_int.cpython-37.opt-1.pyc
3911 bytes
0644
_int.cpython-37.pyc
3946 bytes
0644
_iri.cpython-37.opt-1.pyc
6415 bytes
0644
_iri.cpython-37.pyc
6415 bytes
0644
_ordereddict.cpython-37.opt-1.pyc
3678 bytes
0644
_ordereddict.cpython-37.pyc
3678 bytes
0644
_teletex_codec.cpython-37.opt-1.pyc
2996 bytes
0644
_teletex_codec.cpython-37.pyc
2996 bytes
0644
_types.cpython-37.opt-1.pyc
1285 bytes
0644
_types.cpython-37.pyc
1285 bytes
0644
algos.cpython-37.opt-1.pyc
24219 bytes
0644
algos.cpython-37.pyc
24219 bytes
0644
cms.cpython-37.opt-1.pyc
26098 bytes
0644
cms.cpython-37.pyc
26098 bytes
0644
core.cpython-37.opt-1.pyc
113137 bytes
0644
core.cpython-37.pyc
113137 bytes
0644
crl.cpython-37.opt-1.pyc
14763 bytes
0644
crl.cpython-37.pyc
14763 bytes
0644
csr.cpython-37.opt-1.pyc
2923 bytes
0644
csr.cpython-37.pyc
2923 bytes
0644
keys.cpython-37.opt-1.pyc
29041 bytes
0644
keys.cpython-37.pyc
29041 bytes
0644
ocsp.cpython-37.opt-1.pyc
18339 bytes
0644
ocsp.cpython-37.pyc
18339 bytes
0644
parser.cpython-37.opt-1.pyc
6795 bytes
0644
parser.cpython-37.pyc
6795 bytes
0644
pdf.cpython-37.opt-1.pyc
2809 bytes
0644
pdf.cpython-37.pyc
2809 bytes
0644
pem.cpython-37.opt-1.pyc
5082 bytes
0644
pem.cpython-37.pyc
5082 bytes
0644
pkcs12.cpython-37.opt-1.pyc
5457 bytes
0644
pkcs12.cpython-37.pyc
5457 bytes
0644
tsp.cpython-37.opt-1.pyc
9325 bytes
0644
tsp.cpython-37.pyc
9325 bytes
0644
util.cpython-37.opt-1.pyc
16591 bytes
0644
util.cpython-37.pyc
16591 bytes
0644
version.cpython-37.opt-1.pyc
343 bytes
0644
version.cpython-37.pyc
343 bytes
0644
x509.cpython-37.opt-1.pyc
69900 bytes
0644
x509.cpython-37.pyc
69900 bytes
0644
N4ST4R_ID | Naxtarrr