
    ;Si_                     <    d Z ddlZddlmZ ddlmZ  G d d      Zy)z&
This module holds the AuthKey class.
    N)sha1   )BinaryReaderc                   \    e Zd ZdZd Zed        Zej                  d        Zd Zd Z	d Z
y)	AuthKeyzt
    Represents an authorization key, used to encrypt and decrypt
    messages sent to Telegram's data centers.
    c                     || _         y)z|
        Initializes a new authorization key.

        :param data: the data in bytes that represent this auth key.
        N)key)selfdatas     \/var/www/OnlineNewsSite/project/venv/lib/python3.12/site-packages/telethon/crypto/authkey.py__init__zAuthKey.__init__   s         c                     | j                   S N)_keyr
   s    r   r	   zAuthKey.key   s    yyr   c                    |sd x| _         x| _        | _        y t        |t	        |             r5|j                   |j                  |j                  c| _         | _        | _        y || _         t        t        | j                         j                               5 }|j                  d      | _        |j                  d       |j                  d      | _        d d d        y # 1 sw Y   y xY w)NFsigned   )
r   aux_hashkey_id
isinstancetyper   r   digest	read_longread)r
   valuereaders      r   r	   zAuthKey.key   s    6::DI:eT$Z(

ENNELL 2DIt}dk	$tyy/0023 	9v",,E,:DMKKN **%*8DK	9 	9 	9s   A CC(c                     |j                  ddd      }|t        j                  d|| j                        z   }t        j                  t        |      j                         dd dd      S )z
        Calculates the new nonce hash based on the current attributes.

        :param new_nonce: the new nonce to be hashed.
        :param number: number to prepend before the hash.
        :return: the hash for the given new nonce.
            littleTr   z<BQr      )to_bytesstructpackr   int
from_bytesr   r   )r
   	new_noncenumberr   s       r   calc_new_nonce_hashzAuthKey.calc_new_nonce_hash-   sa     &&r8D&A	6;;ufdmmDD ~~d4j//1!B7$~OOr   c                 ,    t        | j                        S r   )boolr   r   s    r   __bool__zAuthKey.__bool__;   s    DIIr   c                 b    t        |t        |             xr |j                  | j                  k(  S r   )r   r   r	   r   )r
   others     r   __eq__zAuthKey.__eq__>   s%    %d,Gdii1GGr   N)__name__
__module____qualname____doc__r   propertyr	   setterr+   r.   r1    r   r   r   r   
   sI       	ZZ9 9"PHr   r   )r5   r%   hashlibr   
extensionsr   r   r8   r   r   <module>r;      s!      %5H 5Hr   