a
    ñ»j‚  ã                   @   s<   d dl Z d dlmZ ddlmZ dZdZG dd„ deƒZdS )	é    N)ÚOptionalé   )ÚTOTPZ23456789BCDFGHJKMNPQRTVWXYé   c                       sN   e Zd ZdZdeee ee eeddœ‡ fdd„Zeedœ‡ fd	d
„Z‡  Z	S )ÚSteamz=
    Steam's custom TOTP. Subclass of `pyotp.totp.TOTP`.
    Né   r   )ÚsÚnameÚissuerÚintervalÚdigitsÚreturnc                    s"   || _ tƒ j|dtj||d� dS )zÇ
        :param s: secret in base32 format
        :param interval: the time interval in seconds for OTP. This defaults to 30.
        :param name: account name
        :param issuer: issuer
        é
   )r   r   Údigestr	   r
   N)r   ÚsuperÚ__init__ÚhashlibÚsha1)Úselfr   r	   r
   r   r   ©Ú	__class__© ú9E:\soccer\ml_env\Lib\site-packages\pyotp/contrib/steam.pyr      s    zSteam.__init__)Úinputr   c           	         sV   t ƒ  |¡}t|ƒ}d}ttƒ}ttƒD ](}|| }tt|ƒ }||7 }|| }q(|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
        Ú )r   Úgenerate_otpÚintÚlenÚSTEAM_CHARSÚrangeÚSTEAM_DEFAULT_DIGITS)	r   r   Zstr_codeZint_codeZ
steam_codeZtotal_charsÚ_ÚposÚcharr   r   r   r       s    
zSteam.generate_otp)NNr   r   )
Ú__name__Ú
__module__Ú__qualname__Ú__doc__Ústrr   r   r   r   Ú__classcell__r   r   r   r   r   
   s       úùr   )r   Útypingr   Ztotpr   r   r    r   r   r   r   r   Ú<module>   s
   