HEX
Server: LiteSpeed
System: Linux php-prod-1.spaceapp.ru 5.15.0-157-generic #167-Ubuntu SMP Wed Sep 17 21:35:53 UTC 2025 x86_64
User: sport3497 (1034)
PHP: 8.1.33
Disabled: NONE
Upload Files
File: //usr/local/CyberCP/lib64/python3.10/site-packages/ecdsa/__pycache__/_compat.cpython-310.pyc
o

�h��@sdZddlZddlZddlZddlmZdd�ZejdkrdddlZdd�Z	d	d
�Z
ejdks9ejdks9e��d
krFdd�Zdd�Z
dd�Zndd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zd)dd�Zn d d
�Z
d!d�Z	d"d�Z
d#d�Zd$d�ZejZd%d�Zd)d&d�Zd'd(�ZdS)*zD
Common functions for providing cross-python version compatibility.
�N)�
integer_typescCs||}t|t�r|St|�S)z1Take index'th byte from string, return as integer)�
isinstancer�ord)�string�index�val�r�@/usr/local/CyberCP/lib/python3.10/site-packages/ecdsa/_compat.py�str_idx_as_int
s
r
)�rcC�t|�S)�#Cast the input into array of bytes.)�buffer��
buffer_objectrrr	�normalise_bytessrcC�|S�Nr)�retrrr	�hmac_compat�r)��)rr��JavacCst�dd|�S)�,Removes all whitespace from passed in string�\s+�)�re�sub��textrrr	�remove_whitespace#�r"cCrr)�str�rrrr	�compat26_str'sr&cCs|dkrdStt|��dS)Nrr)�len�binr%rrr	�
bit_length*sr)cC�tjdd|tjd�S�rrr)�flags�rr�UNICODEr rrr	r"1�cCrrrr%rrr	r&5rcC�|��S�z8Return number of bits necessary to represent an integer.�r)r%rrr	r)8�cCst�t|��Sr)�binascii�b2a_hexr&r%rrr	r5<sr5c
Cs6ztt�|��WSty}ztd|��d}~ww)N�base16 error: %s��	bytearrayr4�a2b_hex�	Exception�
ValueError�r�errr	r9?s��r9cCsF|sdS|dkrtt|�d�S|dkrtt|ddd��d�Std��)zConvert bytes to an int.r�big��littleN���z(Only 'big' and 'little' endian supported)�intr5r;)r�	byteorderrrr	�bytes_to_intEsrDr>csp|durt��}|dkrt�fdd�ttd|dd��D��S|dkr4t�fdd�td|dd�D��Std	��)
z Return number converted to bytesNr>c3��|]	}�|?d@VqdS��Nr��.0�ir%rr	�	<genexpr>T��
�zint_to_bytes.<locals>.<genexpr>r�r@c3rErFrrHr%rr	rKXrLz'Only 'big' or 'little' endian supported)�byte_lengthr8�reversed�ranger;�r�lengthrCrr%r	�int_to_bytesOs��rScCrrr)�datarrr	r_rcCst|��d�S)r
�B)�
memoryview�castrrrr	rbr#cCrrrr%rrr	r&frcCr*r+r-r rrr	r"ir/c
Cs<ztt�t|d���WSty}ztd|��d}~ww)N�asciir6r7r<rrr	r9ms��cCr0r1r2r%rrr	r)yr3cCs4|durt|�}t|t�st|�}t|j||d��S)zConvert integer to bytes.N)rRrC)rNrrBr8�to_bytesrQrrr	rS}s

cCst|�}|ddS)z9Return number of bytes necessary to represent an integer.rrMr2)rrRrrr	rN�srN)Nr>)�__doc__�sysrr4�sixrr
�version_info�platformrr�systemr"r&r)r5r9rDrSrB�
from_bytesrNrrrr	�<module>s@