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: xnsbb3110 (1041)
PHP: 8.1.33
Disabled: NONE
Upload Files
File: //usr/local/CyberPanel/lib64/python3.10/site-packages/pyotp/__pycache__/otp.cpython-310.pyc
o

��h��@s<ddlZddlZddlZddlmZmZGdd�de�ZdS)�N)�Any�Optionalc
@s�eZdZdZdejddfdededede	ede	ed	dfd
d�Z
ded	efd
d�Zd	efdd�Z
eddeded	efdd��ZdS)�OTPz&
    Base class for OTP handlers.
    �N�s�digits�digest�name�issuer�returncCs6||_|dkrtd��||_||_|pd|_||_dS)N�
z!digits must be no greater than 10�Secret)r�
ValueErrorr�secretr	r
)�selfrrrr	r
�r�?/usr/local/CyberPanel/lib/python3.10/site-packages/pyotp/otp.py�__init__s

zOTP.__init__�inputcCs�|dkrtd��t�|��|�|�|j�}t|���}|dd@}||d@d>||dd@d	>B||d
d@d>B||dd@B}td
|d|j�}||jd�S)z�
        :param input: the HMAC counter value to use as the OTP input.
            Usually either the counter, or the computed integer based on the Unix timestamp
        rzinput must be positive integer������������ld(	rN)	r�hmac�new�byte_secret�int_to_bytestringr�	bytearray�strr)rr�hasher�	hmac_hash�offset�code�str_coderrr�generate_otps����zOTP.generate_otpcCs8|j}t|�d}|dkr|dd|7}tj|dd�S)Nrr�=T)�casefold)r�len�base64�	b32decode)rr�missing_paddingrrrr!/s
zOTP.byte_secretr�i�paddingcCsDt�}|dkr|�|d@�|dL}|dksttt|���|d��S)z�
        Turns an integer to the OATH specified
        bytestring, which is fed to the HMAC
        along with the secret
        rrr�)r#�append�bytes�reversed�rjust)r1r2�resultrrrr"6s�zOTP.int_to_bytestring)r)�__name__�
__module__�__qualname__�__doc__�hashlib�sha1r$�intrrrr*r5r!�staticmethodr"rrrrrs.������
�r)r.r=r�typingrr�objectrrrrr�<module>s